home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / nt / sp3_39.exe / NTAS / UTILITY.IN_ / UTILITY.IN
INI File  |  1994-10-04  |  76KB  |  1,854 lines

  1. [InitBaseVars]
  2. KeyNull            = ""
  3. MAXIMUM_ALLOWED    = 33554432
  4. KeyInfo            = {}
  5. RegistryErrorIndex = NO_ERROR
  6. NoTitle            = 0
  7. CurrentControlSet  = "SYSTEM\CurrentControlSet"
  8. ServicesBaseName   = $(CurrentControlSet)"\Services"
  9. NetworkCardKeyName = $(!NTN_SoftwareBase)"\Microsoft\Windows NT\CurrentVersion\NetworkCards"
  10. !RegLastError      = NO_ERROR
  11. [RegistryErrorSetup]
  12. RegistryErrorIndex = ^(RegistryErrors$(!STF_LANGUAGE),1)
  13. RegistryErrorList = ^(RegistryErrors$(!STF_LANGUAGE),2)
  14. [RegistryErrorString]
  15.      read-syms RegistryErrorSetup
  16.      read-syms RegistryErrorUnknown$(!STF_LANGUAGE)
  17.      set RE_String = *($(RegistryErrorList),~($(RegistryErrorIndex),$($0)))
  18.      Ifstr $(RE_String) == ""
  19.         set RE_String = $(Error_Bogus)
  20.      endif
  21.      return $(RE_String)
  22. [BaseServiceKey]
  23.     read-syms InitBaseVars
  24.     set BS_KeyServices = ""
  25.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName) $(MAXIMUM_ALLOWED) BS_KeyServices
  26.     Ifstr $(BS_KeyServices) == $(KeyNull)
  27.        Debug-Output "UTILITY.INF: could not open Services base key"
  28.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  29.     endif
  30. B_S_Return = +
  31.     return $(RegistryErrorIndex), $(BS_KeyServices)
  32. [ReduceInfPath]
  33.     Set RIP_Result = $($0)
  34.     Split-String $(RIP_Result) "\" InList
  35.     Set BasePath = $(!STF_WINDOWSSYSPATH)"\"
  36.     Split-String $(BasePath) "\" BaseList
  37.     Set Indx = 0
  38.     Set Matched = 0
  39.     QueryListSize InListSize, $(InList)
  40.     ForListDo $(BaseList)
  41.         Set-add Indx = $(Indx),1
  42.         Ifint $(Indx) <= $(InListSize)
  43.             Set Instr = *($(InList),$(Indx))
  44.             Ifstr(i) $($) == $(Instr)
  45.                 Set-add Matched = $(Matched),1
  46.             Endif
  47.         Endif
  48.     EndForListDo
  49.     Ifint $(Indx) == $(Matched)
  50.         Set RIP_Result = ""
  51.         Set Indx2 = 0
  52.         ForListDo $(InList)
  53.             Set-add Indx2 = $(Indx2),1
  54.             Ifint $(Indx2) > $(Indx)
  55.                 Set RIP_Result = $(RIP_Result)$($)
  56.             Endif
  57.         EndForListDo
  58.     Endif
  59.     Return $(RIP_Result)
  60. [InstallSoftwareProduct]
  61.     read-syms InitBaseVars
  62.     set IS_MfgName  = $($0)
  63.     set IS_ProdName = $($1)
  64.     set IS_Infname  = $($2)
  65.     set IS_KeySoftware = ""
  66.     set IS_KeyMfg = ""
  67.     set IS_KeyProduct = ""
  68.     set IS_KeyVersion = ""
  69.     set IS_KeyNetRules = ""
  70.     set IS_MfgCreated = 1
  71.     set IS_ProductCreated = 1
  72.     set RegistryErrorIndex = INVALID_DATA_PASSED
  73.     Ifstr(i) $(IS_MfgName) == ""
  74.        goto I_S_Return
  75.     endif
  76.     Ifstr(i) $(IS_ProdName) == ""
  77.        goto I_S_Return
  78.     endif
  79.     set RegistryErrorIndex = NO_ERROR
  80.     OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_SoftwareBase) $(MAXIMUM_ALLOWED) IS_KeySoftware
  81.     Ifstr $(IS_KeySoftware) == $(KeyNull)
  82.        set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  83.        goto I_S_Return
  84.     endif
  85.     CreateRegKey $(IS_KeySoftware) {$(IS_MfgName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyMfg
  86.     Ifstr $(IS_KeyMfg) == $(KeyNull)
  87.        set IS_MfgCreated = 0
  88.        OpenRegKey $(IS_KeySoftware) "" $(IS_MfgName) $(MAXIMUM_ALLOWED) IS_KeyMfg
  89.        Ifstr $(IS_KeyMfg) == $(KeyNull)
  90.           set RegistryErrorIndex = UNABLE_OPEN_MICROSOFT_KEY
  91.           goto I_S_Return
  92.        endif
  93.     endif
  94.     CreateRegKey $(IS_KeyMfg) {$(IS_ProdName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyProduct
  95.     Ifstr $(IS_KeyProduct) == $(KeyNull)
  96.        set IS_ProductCreated = 0
  97.        OpenRegKey $(IS_KeyMfg) "" $(IS_ProdName) $(MAXIMUM_ALLOWED) IS_KeyProduct
  98.        Ifstr $(IS_KeyProduct) == $(KeyNull)
  99.           set RegistryErrorIndex = UNABLE_CREATE_PRODUCT_KEY
  100.           goto I_S_Return
  101.        endif
  102.     endif
  103.     CreateRegKey $(IS_KeyProduct) {"CurrentVersion",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyVersion
  104.     Ifstr $(IS_KeyVersion) == $(KeyNull)
  105.        OpenRegKey $(IS_KeyProduct) "" "CurrentVersion" $(MAXIMUM_ALLOWED) IS_KeyVersion
  106.        Ifstr $(IS_KeyVersion) == $(KeyNull)
  107.           set RegistryErrorIndex = UNABLE_CREATE_PRODUCT_VERSION
  108.           goto I_S_Return
  109.        endif
  110.     endif
  111.     set RegistryErrorIndex = NO_ERROR
  112.     CreateRegKey $(IS_KeyVersion) {NetRules,$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IS_KeyNetRules
  113.     Ifstr $(IS_KeyNetRules) == $(KeyNull)
  114.        OpenRegKey $(IS_KeyVersion) "" NetRules $(MAXIMUM_ALLOWED) IS_KeyNetRules
  115.        Ifstr $(IS_KeyNetRules) == $(KeyNull)
  116.           set RegistryErrorIndex = UNABLE_CREATE_NETRULES_KEY
  117.           goto I_S_Return
  118.        endif
  119.     endif
  120.     Ifstr $(IS_Infname) != ""
  121.        Shell "", ReduceInfPath, $(IS_Infname)
  122.        SetRegValue $(IS_KeyNetRules) {InfName,$(NoTitle),$(!REG_VT_SZ),$($R0)}
  123.     endif
  124. I_S_Return = +
  125.     Ifstr $(IS_KeyProduct) != ""
  126.         Ifint $(IS_ProductCreated) == 1
  127.            Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  128.               Debug-Output "UTILITY.INF: DeleteRegTree Product Key"
  129.               set IS_KeyProduct = ""
  130.            endif
  131.         endif
  132.         Ifstr $(IS_KeyProduct) != ""
  133.            CloseRegKey $(IS_KeyProduct)
  134.         endif
  135.     endif
  136.     Ifstr $(IS_KeyMfg) != ""
  137.         Ifint $(IS_MfgCreated) == 1
  138.            Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  139.               Debug-Output "UTILITY.INF: DeleteRegTree Manufacturer Key"
  140.               set IS_KeyMfg = ""
  141.            endif
  142.         endif
  143.         Ifstr $(IS_KeyMfg) != ""
  144.            CloseRegKey $(IS_KeyMfg)
  145.         endif
  146.     endif
  147.     Ifstr $(IS_KeySoftware) != ""
  148.         CloseRegKey $(IS_KeySoftware)
  149.     endif
  150.     return $(RegistryErrorIndex), $(IS_KeyVersion), $(IS_KeyNetRules)
  151. [AddValueList]
  152.    set RegistryErrorIndex = NO_ERROR
  153.    ForListDo $($1)
  154.        SetRegValue $($0) $($)
  155.        ifint $(RegLastError) != 0
  156.           Debug-Output "UTILITY.INF: Value write fail data: "$($)
  157.           Debug-Output "UTILITY.INF: Value write fail key: "$($0)
  158.           return UNABLE_WRITE_REGISTRY
  159.        endif
  160.    EndForListDo
  161.    return $(RegistryErrorIndex)
  162. [DeleteSoftwareProduct]
  163.    set RegistryErrorIndex = NO_ERROR
  164.    Debug-Output "UTILITY.INF: DeleteRegTree Software Product"
  165.    DeleteRegTree $($0) ""
  166.    return $(RegistryErrorIndex)
  167. [VerExistedDlg]
  168.    set RegistryErrorIndex = NO_ERROR
  169.    set-subst LF = "\n"
  170.    read-syms VerExisted$(!STF_LANGUAGE)
  171.    set DlgText = $($0)+
  172.              $(ver)+
  173.              $($1)+
  174.              $(Text)
  175.    Shell "Subroutn.Inf" SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(DlgText)
  176.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  177.         set RegistryErrorIndex = ERROR
  178.    endif
  179.    return $(RegistryErrorIndex), $($R1)
  180. [CardExistedDlg]
  181.    set RegistryErrorIndex = NO_ERROR
  182.    set-subst LF = "\n"
  183.    read-syms CardExisted$(!STF_LANGUAGE)
  184.    set DlgText = $(Text)
  185.    Shell "Subroutn.Inf" SetupMessage $(!STF_LANGUAGE) "WARNING" $(DlgText)
  186.    ifint $($ShellCode) != $(!SHELL_CODE_OK)
  187.         set RegistryErrorIndex = ERROR
  188.    endif
  189.    return $(RegistryErrorIndex), $($R1)
  190. [CreateService]
  191.     read-syms InitBaseVars
  192.     set CS_NameOfService = $($0)
  193.     set CS_DisplayName   = $($1)
  194.     set CS_ImagePath     = $($2)
  195.     set CS_TypeOfService = $($3)
  196.     set CS_Group         = $($4)
  197.     set CS_Dependencies  = $($5)
  198.     set CS_ObjectName    = $($6)
  199.     set CS_EventFile     = $($7)
  200.     set CS_TypeSupported = $($8)
  201.     ifstr(i) $(CS_TypeSupported) == ""
  202.         set CS_TypeSupported = 7
  203.     endif
  204.     set CS_EventLogLocation = $($9)
  205.     ifstr(i) $(CS_EventLogLocation) == ""
  206.         set CS_EventLogLocation = "System"
  207.     endif
  208.     set CS_ErrorControl = $($10)
  209.     ifstr(i) $(CS_ErrorControl) == ""
  210.         set CS_ErrorControl = 1
  211.     endif
  212.     set CS_EventSourceName = $($11)
  213.     ifstr(i) $(CS_EventSourceName) == ""
  214.         set CS_EventSourceName = $(CS_NameOfService)
  215.     endif
  216.     set CS_KeyServices   = ""
  217.     set CS_KeyTempSvc    = ""
  218.     set CS_KeySvcManager = ""
  219.     set CS_KeyParameters = ""
  220.     set CS_KeyLinkage    = ""
  221.     set CS_UseRegistry   = $(!NTN_ScUseRegistry)
  222.     Debug-Output "UTILITY.INF: [CreateService] entered for "$(CS_NameOfService)
  223.     Ifstr(i) $(CS_UseRegistry) != "YES"
  224.         Ifstr(i) $(CS_UseRegistry) != "NO"
  225.             Set CS_UseRegistry = "NO"
  226.         Endif
  227.     Endif
  228.     Ifstr(i) $(CS_Dependencies) == ""
  229.         Set CS_Dependencies = {}
  230.     Endif
  231.     Shell "", BaseServiceKey
  232.     set RegistryErrorIndex = $($R0)
  233.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  234.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  235.        goto C_S_Return
  236.     endif
  237.     set CS_KeyServices = $($R1)
  238.     ifstr(i) $(CS_TypeOfService) == "system"
  239.         set TypeValue = 2
  240.         set StartValue = 3
  241.     else-ifstr(i) $(CS_TypeOfService) == "systemstart"
  242.         set TypeValue = 2
  243.         set StartValue = 1
  244.     else-ifstr(i) $(CS_TypeOfService) == "systemauto"
  245.         set TypeValue = 2
  246.         set StartValue = 2
  247.     else-ifstr(i) $(CS_TypeOfService) == "adapter"
  248.         set TypeValue = 4
  249.         set StartValue = 3
  250.         Set CS_UseRegistry = "YES"
  251.     else-ifstr(i) $(CS_TypeOfService) == "kernelauto"
  252.         set TypeValue = 1
  253.         set StartValue = 1
  254.     else-ifstr(i) $(CS_TypeOfService) == "autoserviceshare"
  255.         set TypeValue = 32
  256.         set StartValue = 2
  257.     else-ifstr(i) $(CS_TypeOfService) == "transport"
  258.         set TypeValue = 2
  259.         set StartValue = 3
  260.     else-ifstr(i) $(CS_TypeOfService) == "kernel"
  261.         set TypeValue = 1
  262.         set StartValue = 3
  263.     else-ifstr(i) $(CS_TypeOfService) == "kernelautostart"
  264.         set TypeValue = 1
  265.         set StartValue = 2
  266.     else-ifstr(i) $(CS_TypeOfService) == "kerneldisable"
  267.         set TypeValue = 1
  268.         set StartValue = 4
  269.     else-ifstr(i) $(CS_TypeOfService) == "service"
  270.         set TypeValue = 16
  271.         set StartValue = 3
  272.     else-ifstr(i) $(CS_TypeOfService) == "serviceauto"
  273.         set TypeValue = 16
  274.         set StartValue = 2
  275.     else-ifstr(i) $(CS_TypeOfService) == "serviceshare"
  276.         set TypeValue = 32
  277.         set StartValue = 3
  278.     else
  279.         Set CS_UseRegistry = "YES"
  280.         Debug-Output "UTILITY.INF: [CreateService] Unrecognized TypeOfService parameter"
  281.         set TypeValue = 4
  282.         set StartValue = 3
  283.     endif
  284.     Ifint $(TypeValue) > 4
  285.         Ifstr(i) $(CS_ObjectName) == ""
  286.             set CS_ObjectName = "LocalSystem"
  287.         Endif
  288.     Endif
  289.     OpenRegKey $(CS_KeyServices) "" $(CS_NameOfService) $(MAXIMUM_ALLOWED) +
  290.         CS_KeyTempSvc
  291.     ifstr $(CS_KeyTempSvc) != $(KeyNull)
  292.         GetRegValue $(CS_KeyTempSvc),"DeleteFlag", DeleteFlagInfo
  293.         set DeleteFlag = *($(DeleteFlagInfo), 4)
  294.         ifint $(DeleteFlag) == 1
  295.             Set RegistryErrorIndex = REBOOT_MACHINE_BEFORE_ADD_ADAPTER
  296.             goto C_S_Return
  297.         endif
  298.     endif
  299.     ifstr(i) $(CS_UseRegistry) == "YES"
  300.         Debug-Output "UTILITY.INF: [CreateService] "$(CS_NameOfService)" using Registry"
  301.         OpenRegKey $(CS_KeyServices) "" $(CS_NameOfService) $(MAXIMUM_ALLOWED) +
  302.         CS_KeyTempSvc
  303.         ifstr $(CS_KeyTempSvc) == $(KeyNull)
  304.            CreateRegKey $(CS_KeyServices) {$(CS_NameOfService),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyTempSvc
  305.         else
  306.            Debug-Output "UTILITY.INF: service key "$(CS_NameOfService)" already existed"
  307.            Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  308.            CloseRegKey $(CS_KeyTempSvc)
  309.            CloseRegKey $(CS_KeyServices)
  310.            Goto C_S_Return
  311.         endif
  312.         Ifstr(i) $(CS_KeyTempSvc) == $(KeyNull)
  313.            Debug-Output "UTILITY.INF: could not create service key "$(CS_NameOfService)
  314.            Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  315.            CloseRegKey $(CS_KeyTempSvc)
  316.            CloseRegKey $(CS_KeyServices)
  317.            Goto C_S_Return
  318.         else
  319.             set NewValueList = {+
  320.                                {Type,$(NoTitle),$(!REG_VT_DWORD),$(TypeValue)},+
  321.                                {Start,$(NoTitle),$(!REG_VT_DWORD),$(StartValue)},+
  322.                                {ErrorControl,$(NoTitle),$(!REG_VT_DWORD),$(CS_ErrorControl)}+
  323.                                }
  324.             Ifint $(TypeValue) > 4
  325.                 Set NewValueList = >($(NewValueList), +
  326.                         {ObjectName,$(NoTitle),$(!REG_VT_SZ),$(CS_ObjectName)})
  327.             Endif
  328.             ifstr(i) $(CS_Group) != ""
  329.                 set NewValueList = >($(NewValueList), +
  330.                         {Group,$(NoTitle),$(!REG_VT_SZ),$(CS_Group)})
  331.             endif
  332.             ifstr(i) $(CS_ImagePath) != ""
  333.                 set NewValueList = >($(NewValueList), +
  334.                         {ImagePath,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(CS_ImagePath)})
  335.             endif
  336.             ifstr(i) $(CS_Dependencies) != ""
  337.                 ifstr(i) $(CS_Dependencies) != {}
  338.                     set NewValueList = >($(NewValueList), +
  339.                         {Dependencies,$(NoTitle),$(!REG_VT_MULTI_SZ),$(CS_Dependencies)})
  340.                 endif
  341.             endif
  342.             Shell "", AddValueList, $(CS_KeyTempSvc), $(NewValueList)
  343.             set RegistryErrorIndex = $($R0)
  344.             Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  345.                     Debug-Output "Registry error: Add value list"
  346.             endif
  347.         endif
  348.     else
  349.         Debug-Output "UTILITY.INF: [CreateService] "$(CS_NameOfService)" using CreateService() wrapper"
  350.         Set FLibraryErrCtl = 1
  351.         LibraryProcedure CS_CreateResult $(!NCPA_HANDLE), CPlSetup, $(!STF_HWND), CREATESVC,+
  352.             $(CS_NameOfService), $(CS_DisplayName), $(StartValue), $(TypeValue), $(CS_ErrorControl),+
  353.             $(CS_ImagePath), $(CS_Group),$(CS_Dependencies),$(CS_ObjectName)
  354.         Set FLibraryErrCtl = 0
  355.         Set CS_CreateError = *($(CS_CreateResult),1)
  356.         Ifint $(CS_CreateError) != 0
  357.              Debug-Output "UTILITY.INF: CreateService wrapper failed, error: "$(CS_CreateResult)
  358.              Ifint $(CS_CreateResult) == 1073
  359.                  Set RegistryErrorIndex = SERVICE_ALREADY_EXISTS
  360.              Else-ifint $(CS_CreateResult) == 1072
  361.                  Set RegistryErrorIndex = SERVICE_MARKED_FOR_DELETE
  362.              Else
  363.                  Set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  364.              Endif
  365.              CloseRegKey $(CS_KeyTempSvc)
  366.              CloseRegKey $(CS_KeyServices)
  367.              Goto C_S_Return
  368.         Endif
  369.         OpenRegKey $(CS_KeyServices) "" $(CS_NameOfService) $(MAXIMUM_ALLOWED) CS_KeyTempSvc
  370.         ifstr $(CS_KeyTempSvc) == $(KeyNull)
  371.              Debug-Output "UTILITY.INF: unable to open new service key"
  372.              set RegistryErrorIndex = UNABLE_CREATE_CONFIGURE_SERVICE
  373.              CloseRegKey $(CS_KeyTempSvc)
  374.              CloseRegKey $(CS_KeyServices)
  375.              Goto C_S_Return
  376.         endif
  377.     endif
  378.     OpenRegKey $(CS_KeyTempSvc) "" "Parameters" $(MAXIMUM_ALLOWED) +
  379.         CS_KeyParameters
  380.     ifstr $(CS_KeyParameters) == $(KeyNull)
  381.         CreateRegKey $(CS_KeyTempSvc) {"Parameters",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyParameters
  382.     endif
  383.     Ifstr $(CS_KeyParameters) == $(KeyNull)
  384.        set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
  385.        CloseRegKey $(CS_KeyTempSvc)
  386.        CloseRegKey $(CS_KeyServices)
  387.        goto C_S_Return
  388.     endif
  389.     set RegistryErrorIndex = NO_ERROR
  390.     OpenRegKey $(CS_KeyTempSvc) "" "Linkage" $(MAXIMUM_ALLOWED) CS_KeyLinkage
  391.     Ifstr $(CS_KeyLinkage) == $(KeyNull)
  392.         CreateRegKey $(CS_KeyTempSvc) {"Linkage",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyLinkage
  393.     Endif
  394.     Ifstr $(CS_KeyLinkage) == $(KeyNull)
  395.        set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
  396.        CloseRegKey $(CS_KeyTempSvc)
  397.        CloseRegKey $(CS_KeyServices)
  398.        goto C_S_Return
  399.     endif
  400.     OpenRegKey $(CS_KeyLinkage) "" "Disabled" $(MAXIMUM_ALLOWED) CS_KeyDisabled
  401.     Ifstr $(CS_KeyDisabled) == $(KeyNull)
  402.         CreateRegKey $(CS_KeyLinkage) {"Disabled",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyDisabled
  403.     Endif
  404.     Ifstr $(CS_KeyDisabled) == $(KeyNull)
  405.        set RegistryErrorIndex = UNABLE_CREATE_SERVICE_SUBKEY
  406.        CloseRegKey $(CS_KeyTempSvc)
  407.        CloseRegKey $(CS_KeyServices)
  408.        CloseRegKey $(CS_KeyLinkage)
  409.        goto C_S_Return
  410.     endif
  411.     CloseRegKey $(CS_KeyDisabled)
  412.     ifstr(i) $(CS_EventFile) != ""
  413.         OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services\EventLog\"$(CS_EventLogLocation) $(MAXIMUM_ALLOWED) CS_KeyEventLog
  414.         Ifstr $(CS_KeyEventLog) == $(KeyNull)
  415.            debug-output "Cannot open eventlog key"
  416.            set RegistryErrorIndex = UNABLE_OPEN_EVENTLOG_SUBKEY
  417.            CloseRegKey $(CS_KeyTempSvc)
  418.            CloseRegKey $(CS_KeyServices)
  419.            CloseRegKey $(CS_KeyParameters)
  420.            CloseRegKey $(CS_KeyLinkage)
  421.            goto C_S_Return
  422.         else
  423.            OpenRegKey $(CS_KeyEventLog) "" $(CS_EventSourceName) $(MAXIMUM_ALLOWED) CS_KeyService
  424.            ifstr(i) $(CS_KeyService) == ""
  425.                CreateRegKey $(CS_KeyEventLog) {$(CS_EventSourceName),$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" CS_KeyService
  426.            endif
  427.            Ifstr $(CS_KeyService) != $(KeyNull)
  428.                SetRegValue $(CS_KeyService) {EventMessageFile,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(CS_EventFile)}
  429.                SetRegValue $(CS_KeyService) {TypesSupported,$(NoTitle),$(!REG_VT_DWORD),$(CS_TypeSupported)}
  430.                CloseRegKey $(CS_KeyService)
  431.            endif
  432.         Endif
  433.     endif
  434. C_S_Return = +
  435.     Ifstr $(CS_KeyServices) != $(KeyNull)
  436.         CloseRegKey $(CS_KeyServices)
  437.     endif
  438.     return $(RegistryErrorIndex), $(CS_KeyTempSvc), $(CS_KeyParameters), $(CS_KeyLinkage)
  439. [AssignAdapterNumber]
  440.     read-syms InitBaseVars
  441.     set AA_AdapterNumber = 1
  442.     set AA_KeyNetcards = ""
  443.     set AA_KeyTemp = ""
  444.     set RegistryErrorIndex = NO_ERROR
  445.     OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardKeyName) $(MAXIMUM_ALLOWED) AA_KeyNetcards
  446.     Ifstr $(AA_KeyNetcards) == $(KeyNull)
  447.        set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  448.        goto A_A_Return
  449.     endif
  450. A_A_TryAgain = +
  451.     Ifint $(AA_AdapterNumber) > 100
  452.         Set AA_AdapterNumber = 0
  453.         Set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  454.         Goto A_A_Found
  455.     Endif
  456.     ifint $(AA_AdapterNumber) < 10
  457.         set Tmp_AA_AdapterNumber = "0"$(AA_AdapterNumber)
  458.     else
  459.         set Tmp_AA_AdapterNumber = $(AA_AdapterNumber)
  460.     endif
  461.     OpenRegKey $(AA_KeyNetcards) "" $(Tmp_AA_AdapterNumber) $(MAXIMUM_ALLOWED) AA_KeyTemp
  462.     Ifstr $(AA_KeyTemp) == $(KeyNull)
  463.         Goto A_A_Found
  464.     Endif
  465.     CloseRegKey $(AA_KeyTemp)
  466.     Set AA_KeyTemp = $(KeyNull)
  467.     Set-add AA_AdapterNumber = $(AA_AdapterNumber),1
  468.     Goto A_A_TryAgain
  469. A_A_Found =+
  470.     IfInt $(AA_AdapterNumber) <= 9
  471.         set AA_AdapterNumber = "0"$(AA_AdapterNumber)
  472.     endif
  473.     CloseRegKey $(AA_KeyNetcards)
  474. A_A_Return = +
  475.     return $(RegistryErrorIndex) $(AA_AdapterNumber)
  476. [InstallNetcard]
  477.    read-syms InitBaseVars
  478.    set IN_Infname     = $($0)
  479.    set IN_CardNumber  = 0
  480.    set IN_KeyNetcard  = ""
  481.    set IN_KeyNetRules = ""
  482.     Shell "" AssignAdapterNumber
  483.     set RegistryErrorIndex = $($R0)
  484.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  485.         goto I_N_Return
  486.     endif
  487.     set IN_CardNumber = $($R1)
  488.     CreateRegKey $(!REG_H_LOCAL) {$(NetworkCardKeyName)\$(IN_CardNumber),$(NoTitle),GenericClass} +
  489.                   "" $(MAXIMUM_ALLOWED) "" IN_KeyNetcard
  490.     Ifstr $(IN_KeyNetcard) == $(KeyNull)
  491.        set RegistryErrorIndex = UNABLE_CREATE_NETCARD_CONFIGURATION
  492.        goto I_N_Return
  493.     endif
  494.     CreateRegKey $(IN_KeyNetcard) {NetRules,$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" IN_KeyNetRules
  495.     Ifstr $(IN_KeyNetRules) == $(KeyNull)
  496.        set RegistryErrorIndex = UNABLE_CREATE_NETRULES_KEY
  497.        goto I_N_Return
  498.     endif
  499.     Ifstr $(IN_Infname) != ""
  500.        Shell "", ReduceInfPath, $(IN_Infname)
  501.        SetRegValue $(IN_KeyNetRules) {InfName,$(NoTitle),$(!REG_VT_SZ),$($R0)}
  502.     endif
  503.     set RegistryErrorIndex = NO_ERROR
  504. I_N_Return = +
  505.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  506.         Debug-Output "UTILITY.INF: [InstallNetcard]: "$(RegistryErrorIndex)
  507.         Ifstr $(IN_KeyNetRules) != $(KeyNull)
  508.             CloseRegKey $(IN_KeyNetRules)
  509.             set IN_KeyNetrules = ''
  510.         endif
  511.         set IN_KeyNetcard = ""
  512.     endif
  513.     return $(RegistryErrorIndex), $(IN_KeyNetcard), $(IN_CardNumber), $(IN_KeyNetRules)
  514. [LinkToService]
  515.     read-syms InitBaseVars
  516.     SetRegValue $($0) {ServiceName,$(NoTitle),$(!REG_VT_SZ),$($1)}
  517. L_S_Return = +
  518.     return $(RegistryErrorIndex)
  519. [IncrementRefCount]
  520.     read-syms InitBaseVars
  521.     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
  522.     Ifstr $(SoftwareKey) == $(KeyNull)
  523.        Debug-Output "UTILITY.INF: could not open Software base key"
  524.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  525.        goto IncrementRefCount_Return
  526.     endif
  527.     GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
  528.     set RefCount = *($(RefCountInfo), 4)
  529.     Set-add RefCount = $(RefCount),1
  530.     SetRegValue $(SoftwareKey) {RefCount,$(NoTitle),$(!REG_VT_DWORD),$(RefCount)}
  531.     CloseRegKey $(SoftwareKey)
  532. IncrementRefCount_Return = +
  533.     return $(RegistryErrorIndex)
  534. [DecrementRefCount]
  535.     read-syms InitBaseVars
  536.     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
  537.     Ifstr $(SoftwareKey) == $(KeyNull)
  538.        Debug-Output "UTILITY.INF: could not open Software base key"
  539.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  540.        goto DecrementRefCount_Return
  541.     endif
  542.     GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
  543.     set RefCount = *($(RefCountInfo), 4)
  544.     ifint $(RefCount) == 0
  545.         goto DecrementRefCount_Return
  546.     endif
  547.     Set-sub RefCount = $(RefCount),1
  548.     SetRegValue $(SoftwareKey) {RefCount,$(NoTitle),$(!REG_VT_DWORD),$(RefCount)}
  549.     CloseRegKey $(SoftwareKey)
  550. DecrementRefCount_Return = +
  551.     return $(RegistryErrorIndex)
  552. [IsRefCountEqualZero]
  553.     read-syms InitBaseVars
  554.     OpenRegKey $(!REG_H_LOCAL) "" $($0) $(MAXIMUM_ALLOWED) SoftwareKey
  555.     Ifstr $(SoftwareKey) == $(KeyNull)
  556.        Debug-Output "UTILITY.INF: could not open Software base key"
  557.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  558.        goto IsRefCountEqualZero_Return
  559.     endif
  560.     GetRegValue $(SoftwareKey),"RefCount", RefCountInfo
  561.     set RefCount = *($(RefCountInfo), 4)
  562.     Ifint $(RefCount) == 0
  563.         set RefCountEqualZero = 1
  564.     else
  565.         set RefCountEqualZero = 0
  566.     endif
  567.     CloseRegKey $(SoftwareKey)
  568. IsRefCountEqualZero_Return = +
  569.     return $(RegistryErrorIndex) $(RefCountEqualZero)
  570. [FindService]
  571.     read-syms InitBaseVars
  572.     set FS_KeyThisService = ""
  573.     set FS_KeyParameters  = ""
  574.     set FS_KeyComponent   = $($0)
  575.     set FS_TypeComponent  = $($1)
  576.     Shell "", BaseServiceKey
  577.     set FS_KeyServices = $($R1)
  578.     set RegistryErrorIndex = $($R0)
  579.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  580.        goto F_S_Return
  581.     endif
  582.     EnumRegValue $(FS_KeyComponent) FS_ValueList
  583.     set FS_SvcName = ""
  584.     ForListDo $(FS_ValueList)
  585.         set FS_ValueName = *($($),1)
  586.         Ifstr(i) $(FS_ValueName) == ServiceName
  587.             set FS_SvcName = *($($),4)
  588.             goto F_S_Break1
  589.         endif
  590.     EndForListDo
  591. F_S_Break1 = +
  592.     Ifstr $(FS_SvcName) == $(KeyNull)
  593.        set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  594.        goto F_S_Return
  595.     endif
  596.     OpenRegKey $(FS_KeyServices) "" $(FS_SvcName) $(MAXIMUM_ALLOWED) FS_KeyThisService
  597.     Ifstr $(FS_KeyThisService) == $(KeyNull)
  598.        set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  599.        goto F_S_Return
  600.     endif
  601.     OpenRegKey $(FS_KeyThisService) "" "Parameters" $(MAXIMUM_ALLOWED) FS_KeyParameters
  602.     Ifstr $(FS_KeyParameters) == $(KeyNull)
  603.        set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
  604.        goto F_S_Return
  605.     endif
  606. F_S_Return = +
  607.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  608.         Ifstr $(FS_KeyParameters) != $(KeyNull)
  609.             CloseRegKey $(FS_KeyParameters)
  610.         endif
  611.         Ifstr $(FS_KeyThisService) != $(KeyNull)
  612.            CloseRegKey $(FS_KeyThisService)
  613.         endif
  614.     endif
  615.     return $(RegistryErrorIndex), $(FS_KeyThisService) $(FS_KeyParameters)
  616. [GetServiceParameters]
  617.     read-syms InitBaseVars
  618.     set GP_KeyComponent = $($0)
  619.     set GP_KeyService = ""
  620.     set GP_KeyParameters = ""
  621.     set GP_ValueList  = {}
  622.     FindService $(GP_KeyComponent) $($1)
  623.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  624.         goto G_P_Return
  625.     endif
  626.     set GP_KeyService = $($R1)
  627.     set GP_KeyParameters = $($R2)
  628.     EnumRegValue $(GP_KeyParameters) GP_ValueList
  629. G_P_Return = +
  630.     return $(RegistryErrorIndex) $(GP_KeyService) $(GP_KeyParameters) $(GP_ValueList)
  631. [AddSoftwareComponent]
  632.     read-syms InitBaseVars
  633.     set AS_MfgName       = $($0)
  634.     set AS_ProdName      = $($1)
  635.     set AS_SvcName       = $($2)
  636.     set AS_DisplayName   = $($3)
  637.     set AS_Infname       = $($4)
  638.     set AS_ImagePath     = $($5)
  639.     set AS_ServiceType   = $($6)
  640.     set AS_Group         = $($7)
  641.     set AS_Dependencies  = $($8)
  642.     set AS_ObjectName    = $($9)
  643.     set AS_EventFile     = $($10)
  644.     set AS_TypeSupported = $($11)
  645.     set AS_EventLocation = $($12)
  646.     set AS_ErrorCtlValue = $($13)
  647.     set AS_EventSource   = $($14)
  648.     set AS_KeyVersion    = ""
  649.     set AS_KeyNetRules   = ""
  650.     set AS_KeyService    = ""
  651.     set AS_KeyParameters = ""
  652.     set AS_KeyLinkage    = ""
  653.     Shell "", CreateService,$(AS_SvcName),$(AS_DisplayName),$(AS_ImagePath),+
  654.           $(AS_ServiceType),$(AS_Group),$(AS_Dependencies),$(AS_ObjectName),+
  655.           $(AS_EventFile),$(AS_TypeSupported),+
  656.           $(AS_EventLocation),$(AS_ErrorCtlValue),$(AS_EventSource)
  657.     set RegistryErrorIndex = $($R0)
  658.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  659.        goto A_S_Return
  660.     endif
  661.     set AS_KeyService    = $($R1)
  662.     set AS_KeyParameters = $($R2)
  663.     set AS_KeyLinkage    = $($R3)
  664.     Shell "", InstallSoftwareProduct, $(AS_MfgName), $(AS_ProdName), $(AS_Infname)
  665.     set RegistryErrorIndex = $($R0)
  666.     Ifstr(i) $(RegistryErrorIndex) == NO_ERROR
  667.         set AS_KeyVersion  = $($R1)
  668.         set AS_KeyNetRules = $($R2)
  669.         Shell "", LinkToService, $(AS_KeyVersion), $(AS_SvcName), service
  670.         set RegistryErrorIndex = $($R0)
  671.         Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  672.             goto A_S_Return
  673.         endif
  674.         GetRegValue $(AS_KeyVersion),"RefCount", RefCountInfo
  675.         Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  676.             SetRegValue $(AS_KeyVersion) {RefCount,$(NoTitle),$(!REG_VT_DWORD),0}
  677.         endif
  678.     endif
  679. A_S_Return = +
  680.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  681.        Ifstr $(AS_KeyNetRules) != $(KeyNull)
  682.           CloseRegKey $(AS_KeyNetRules)
  683.        endif
  684.        Ifstr $(AS_KeyParameters) != $(KeyNull)
  685.           CloseRegKey $(AS_KeyParameters)
  686.        endif
  687.        Ifstr $(AS_KeyLinkage) != $(KeyNull)
  688.           CloseRegKey $(AS_KeyLinkage)
  689.        endif
  690.        Ifstr $(AS_KeyVersion) != $(KeyNull)
  691.           CloseRegKey $(AS_KeyVersion)
  692.           Set AS_ProdKeyName = $(!NTN_SoftwareBase)"\"$(AS_MfgName)"\"$(AS_ProdName)
  693.           OpenRegKey $(!REG_H_LOCAL) "" $(AS_ProdKeyName) $(MAXIMUM_ALLOWED) AS_KeyProduct
  694.           Ifstr(i) $(AS_KeyProduct) != $(KeyNull)
  695.               DeleteRegKey $(AS_KeyProduct) "CurrentVersion"
  696.               CloseRegKey $(AS_KeyProduct)
  697.           Endif
  698.        Endif
  699.        Ifstr $(AS_KeyService) != $(KeyNull)
  700.           Debug-Output "UTILITY.INF: DeleteRegTree Service Key"
  701.        endif
  702.        set AS_KeyVersion = ""
  703.        set AS_KeyNetRules = ""
  704.        set AS_KeyService = ""
  705.        set AS_KeyParameters = ""
  706.        set AS_KeyLinkage = ""
  707.     endif
  708.     return $(RegistryErrorIndex), $(AS_KeyVersion), $(AS_KeyNetRules), $(AS_KeyService),+
  709.            $(AS_KeyParameters), $(AS_KeyLinkage)
  710. [AddHardwareComponent]
  711.     read-syms InitBaseVars
  712.     set AH_SvcName       = $($0)
  713.     set AH_Infname       = $($1)
  714.     set AH_SoftwareName  = $($2)
  715.     set AH_KeyNetcard    = ""
  716.     set AH_KeyNetRules   = ""
  717.     set AH_KeyService    = ""
  718.     set AH_KeyParameters = ""
  719.     set AH_AdapNum       = -1
  720.     Shell "", InstallNetcard, $(AH_Infname)
  721.     set RegistryErrorIndex = $($R0)
  722.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  723.         Debug-Output "UTILITY.INF: [AddHardwareComponent] InstallNetcard returned: "$(RegistryErrorIndex)
  724.         goto A_H_Return
  725.     endif
  726.     set AH_KeyNetcard  = $($R1)
  727.     set AH_AdapNum     = $($R2)
  728.     set AH_SvcName     = $(AH_SvcName)$(AH_AdapNum)
  729.     set AH_KeyNetRules = $($R3)
  730.     Shell "", CreateService, $(AH_SvcName), "", "", "adapter","",{}
  731.     set RegistryErrorIndex = $($R0)
  732.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  733.         Debug-Output "UTILITY.INF: CreateService returned "$(RegistryErrorIndex)
  734.         goto A_H_Return
  735.     endif
  736.     CloseRegKey $($R1)
  737.     set AH_KeyParameters = $($R2)
  738.     CloseRegKey $($R3)
  739.     Shell "", LinkToService, $(AH_KeyNetcard), $(AH_SvcName)
  740.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  741.         Debug-Output "UTILITY.INF: [AddHardwareComponent] LinkToService returned "$(RegistryErrorIndex)
  742.         goto A_H_Return
  743.     endif
  744.     Shell "", IncrementRefCount, $(AH_SoftwareName)
  745.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  746.         Debug-Output "UTILITY.INF: [AddHardwareComponent] IncrementRefCount returned "$(RegistryErrorIndex)
  747.         goto A_H_Return
  748.     endif
  749. A_H_Return = +
  750.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  751.         Debug-Output "UTILITY.INF: [AddHardwareComponent] returning error: "$(RegistryErrorIndex)
  752.         Ifstr(i) $(AH_KeyNetRules) != $(KeyNull)
  753.            CloseRegKey $(AH_KeyNetRules)
  754.         Endif
  755.         Ifstr(i) $(AH_KeyNetcard) != $(KeyNull)
  756.         Endif
  757.         set AH_KeyNetRules = ""
  758.         set AH_KeyNetcard = ""
  759.     endif
  760.     return $(RegistryErrorIndex), $(AH_KeyNetcard), $(AH_KeyNetRules), $(AH_KeyParameters),+
  761.            $(AH_AdapNum), $(AH_SvcName)
  762. [MCAFindBus]
  763.     read-syms InitBaseVars
  764.     set RegistryErrorIndex = NO_ERROR
  765.     set MultifunctionAdapter = "HARDWARE\Description\System\MultifunctionAdapter"
  766.     set InfoList = {}
  767.     OpenRegKey $(!REG_H_LOCAL) "" $(MultifunctionAdapter) $(MAXIMUM_ALLOWED) KeyMultiAdapter
  768.     Ifstr $(KeyMultiAdapter) == $(KeyNull)
  769.         goto MCAFindBus_return
  770.     endif
  771.     EnumRegKey $(KeyMultiAdapter) BusList
  772.     Debug-Output "Buslist"
  773.     Debug-Output $(BusList)
  774.     ForListDo $(BusList)
  775.         set BusNum = *($($),1)
  776.         set RegName = $(MultifunctionAdapter)"\"$(BusNum)
  777.         Debug-Output "BusNum"
  778.         Debug-Output $(BusNum)
  779.         OpenRegKey $(!REG_H_LOCAL) "" $(RegName) $(MAXIMUM_ALLOWED) KeyBus
  780.         ifstr $(KeyBus) != $(KeyNull)
  781.             GetRegValue $(KeyBus),"Configuration Data",ConfigData
  782.             ifstr $(ConfigData) != $(KeyNull)
  783.                 set CardInfo = *($(ConfigData), 4 )
  784.                 set Position = 33
  785.                 set SlotNum = 1
  786.                 QueryListSize ListSize $(CardInfo)
  787. Loop1 =+
  788.                 ifint $(Position) < $(ListSize)
  789.                     set-add NextByte = $(Position), 1
  790.                     ifint *($(CardInfo), $(Position)) == $($0)
  791.                         ifint *($(CardInfo), $(NextByte)) == $($1)
  792.                             Debug-Output $(BusNum)
  793.                             Debug-Output $(SlotNum)
  794.                             set-mul mcaid = $($1), 256
  795.                             set-add mcaid = $(mcaid), $($0)
  796.                             set InfoList = >($(InfoList),{$(BusNum),$(SlotNum),$(mcaid)})
  797.                         endif
  798.                     endif
  799.                     set-add Position = $(Position), 6
  800.                     set-add SlotNum = $(SlotNum), 1
  801.                     goto Loop1
  802.                 endif
  803.             endif
  804.             CloseRegKey $(KeyBus)
  805.         endif
  806.     EndForListDo
  807.     CloseRegKey $(KeyMultiAdapter)
  808. MCAFindBus_return = +
  809.     return $(RegistryErrorIndex) $(InfoList)
  810. [EISAFindBus]
  811.     read-syms InitBaseVars
  812.     set MaskNum = $($1)
  813.     ifstr(i) $($1) == ""
  814.         set MaskNum = 16777215  
  815.     endif
  816.     set RegistryErrorIndex = NO_ERROR
  817.     set EISAAdapter = "HARDWARE\Description\System\EISAAdapter"
  818.     set InfoList = {}
  819.     OpenRegKey $(!REG_H_LOCAL) "" $(EISAAdapter) $(MAXIMUM_ALLOWED) KeyEISAAdapter
  820.     Ifstr $(KeyEISAAdapter) == $(KeyNull)
  821.         goto EISAFindBus_return
  822.     endif
  823.     EnumRegKey $(KeyEISAAdapter) BusList
  824.     Debug-Output "Buslist"
  825.     Debug-Output $(BusList)
  826.     ForListDo $(BusList)
  827.         set BusNum = *($($),1)
  828.         OpenRegKey $(!REG_H_LOCAL) "" $(EISAAdapter)"\"$(BusNum) $(MAXIMUM_ALLOWED) KeyEISAAdapterBus
  829.         LibraryProcedure SlotList, $(!LIBHANDLE), GetEisaSlotInformation, $(KeyEISAAdapterBus), "Configuration Data", $($0), $(MaskNum)
  830.         ifstr(i) $(SlotList) != {}
  831.             ForListDo $(SlotList)
  832.                 set SlotNum = $($)
  833.                 ifstr(i) $(SlotNum) != "ERROR"
  834.                     Debug-Output $(BusNum)
  835.                     Debug-Output $(SlotNum)
  836.                     set InfoList = >($(InfoList),{$(BusNum),$(SlotNum),$($0)})
  837.                 endif
  838.             EndForListDo
  839.         endif
  840.     EndForListDo
  841.     CloseRegKey $(KeyEISAAdapter)
  842. EISAFindBus_return = +
  843.     return $(RegistryErrorIndex) $(InfoList)
  844. [AddNetworkProvider]
  845.     read-syms InitBaseVars
  846.     set RegistryErrorIndex = NO_ERROR
  847.     set ProviderDeviceName = $($3)
  848.     ifstr(i) $(ProviderDeviceName) == ""
  849.         set ProviderDeviceName = $($0)
  850.     endif
  851.     OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\NetworkProvider\order" $(MAXIMUM_ALLOWED) OrderKey
  852.     ifstr(i) $(OrderKey) == $(KeyNull)
  853.                   CreateRegKey $(!REG_H_LOCAL) {$(CurrentControlSet)"\control\NetworkProvider\order",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" OrderKey
  854.     endif
  855.     GetRegValue $(OrderKey) "ProviderOrder" OrderValue
  856.     set Order = *($(OrderValue), 4 )
  857.     ifstr(i) $(OrderValue) == $(KeyNull)
  858.                 goto AddFirstProvider
  859.     else-ifstr(i) $(Order) == $(KeyNull)
  860.                 goto AddFirstProvider
  861.     else
  862.                 goto AddProvider
  863.     endif
  864. AddFirstProvider = +
  865.     SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$($0)}
  866.     goto WriteProviderInfo
  867. AddProvider = +
  868.     Split-String $(Order) "," OrderList
  869.     ifContains(i) $($0) in $(OrderList)
  870.     else
  871.         set Order = $(Order)","$($0)
  872.         SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$(Order)}
  873.     endif
  874.     goto WriteProviderInfo
  875. WriteProviderInfo = +
  876.     CloseRegKey $(OrderKey)
  877.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\"$($0)"\networkprovider" $(MAXIMUM_ALLOWED) ProviderKey
  878.     Ifstr(i) $(ProviderKey) == $(KeyNull)
  879.         CreateRegKey $(!REG_H_LOCAL) {$(ServicesBaseName)"\"$($0)"\networkprovider",$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" ProviderKey
  880.     endif
  881.     set NewValueList = {{Devicename,$(NoTitle),$(!REG_VT_SZ),"\device\"$(ProviderDeviceName)},+
  882.                         {ProviderPath, $(NoTitle), $(!REG_VT_EXPAND_SZ), $($1)},+
  883.                         {Name, $(NoTitle), $(!REG_VT_SZ), $($2)}}
  884.     Shell "" AddValueList $(ProviderKey) $(NewValueList)
  885.     CloseRegKey $(ProviderKey)
  886. AddNetworkProvider_return = +
  887.     return $(RegistryErrorIndex)
  888. [RemoveNetworkProvider]
  889.     read-syms InitBaseVars
  890.     set RegistryErrorIndex = NO_ERROR
  891.     OpenRegKey $(!REG_H_LOCAL) "" $(CurrentControlSet)"\control\NetworkProvider\order" $(MAXIMUM_ALLOWED) OrderKey
  892.     ifstr(i) $(OrderKey) == $(KeyNull)
  893.         set RegistryErrorIndex = PROVIDER_ORDER_DOES_NOT_EXIST
  894.         goto RemoveNetworkProvider_return
  895.     endif
  896.     GetRegValue $(OrderKey) "ProviderOrder" OrderValue
  897.     set Order = *($(OrderValue), 4 )
  898.     Split-String $(Order) "," OrderList
  899.     set NewOrderList = {}
  900.     set FirstTime = TRUE
  901.     set Found = FALSE
  902.     ForListDo $(OrderList)
  903.         ifstr(i) $($) != ","
  904.             ifstr(i) $($) != $($0)
  905.                 ifstr(i) $(FirstTime) == TRUE
  906.                     set FirstTime = FALSE
  907.                     set NewOrderList = $($)
  908.                 else
  909.                     set NewOrderList = $(NewOrderList)","$($)
  910.                 endif
  911.             else
  912.                 set Found = TRUE
  913.             endif
  914.         endif
  915.     EndForListDo
  916.     ifstr(i) $(Found) == FALSE
  917.         set RegistryErrorIndex = PROVIDER_ORDER_DOES_NOT_EXIST
  918.         goto RemoveNetworkProvider_return
  919.     else
  920.         ifstr(i) $(NewOrderList) == {}
  921.             set NewOrderList = ""
  922.         endif
  923.         SetRegValue $(OrderKey) {ProviderOrder,$(NoTitle),$(!REG_VT_SZ),$(NewOrderList)}
  924.     endif
  925.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName) $(MAXIMUM_ALLOWED) ProviderKey
  926.     ifstr $(ProviderKey) != $(KeyNull)
  927.         DeleteRegTree $(ProviderKey) $($0)
  928.     endif
  929. RemoveNetworkProvider_return = +
  930.     return $(RegistryErrorIndex)
  931. [PrepareToCopy]
  932.     Read-syms ProgressCopy$(!STF_LANGUAGE)
  933.     Return STATUS_SUCCESSFUL
  934. [DoAskSource]
  935.     Set DAS_CWDDIR  = $($0)
  936.     Set DAS_SRCDIR  = $($1)
  937.     Set DAS_BUILTIN = $($2)
  938.     Set DAS_Result  = STATUS_FAILED
  939.     Ifstr(i) $(!STF_SRCDIR_OVERRIDE) != ""
  940.         Set DAS_SRCDIR = $(!STF_SRCDIR_OVERRIDE)
  941.         Set DAS_Result = STATUS_SUCCESSFUL
  942.         Goto DAS_exit
  943.     Endif
  944.     Ifstr(i) $(DAS_BUILTIN) == YES
  945.         Ifstr(i) $(!NTN_InstallPhase) == primary
  946.             Ifstr(i) $(!STF_SRCDIR_WINNT) != ""
  947.                 Set DAS_SRCDIR = $(!STF_SRCDIR_WINNT)
  948.             Endif
  949.             Set DAS_Result = STATUS_SUCCESSFUL
  950.             Goto DAS_exit
  951.         Endif
  952.     Endif
  953.     Debug-Output "UTILITY.INF: [DoAskSource] STF_CWDDIR = "$(DAS_CWDDIR)" STF_SRCDIR = "$(DAS_SRCDIR)
  954.     Ifstr(i) $(DAS_SRCDIR) == ""
  955.         Set DAS_SRCDIR = "A:\"
  956.     Endif
  957.     Ifstr(i) $(DAS_SRCDIR) == $(!STF_SRCDIR_USED)
  958.         Set DAS_SRCDIR = $(!STF_SRCDIR_KEYED)
  959.     Endif
  960.     Shell "subroutn.inf" DoAskSource $(DAS_SRCDIR)
  961.     ifint $($ShellCode) != $(!SHELL_CODE_OK)
  962.         Debug-Output "UTILITY.INF: shelling SUBROUTN.INF [DoAskSource] failed"
  963.         goto DAS_exit
  964.     endif
  965.     Set DAS_Result = $($R0)
  966.     Ifstr(i) $(DAS_Result) == STATUS_USERCANCEL
  967.         Set !p:CommonStatus = STATUS_USERCANCEL
  968.         goto DAS_exit
  969.     Endif
  970.     Set DAS_SRCDIR = $($R1)
  971.     Set !STF_SRCDIR_USED = $($R1)
  972.     Set !STF_SRCDIR_KEYED = $($R3)
  973. DAS_exit =+
  974.     Read-syms ProgressCopy$(!STF_LANGUAGE)
  975.     Return $(DAS_Result) $(DAS_SRCDIR)
  976. [RemoveSoftwareComponent]
  977.     Debug-Output "Remove Software Component..."
  978.     read-syms InitBaseVars
  979.     set RS_Manufacturer = $($0)
  980.     set RS_ProductName  = $($1)
  981.     set RS_CheckRefCount = $($2)
  982.     set RS_VersionNum   = "CurrentVersion"
  983.     set RS_ManufacturerKey = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)
  984.     set RS_ProductKey   = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)"\"$(RS_ProductName)
  985.     set RS_ProductVerKey        = $(!NTN_SoftwareBase)"\"$(RS_Manufacturer)"\"$(RS_ProductName)"\"$(RS_VersionNum)
  986.     set RegistryErrorIndex      = NO_ERROR
  987.     ifstr(i) $(RS_CheckRefCount) != FALSE
  988.         Shell "", IsRefCountEqualZero, $(RS_ProductVerKey)
  989.         Ifstr(i) $($R0) != NO_ERROR
  990.             Debug-Output "UTILITY.INF: [RemoveSoftwareComponent] IsRefCountEqualZero returned "$($R0)
  991.             goto RemoveSoftwareComponent_Return
  992.         endif
  993.         Ifint $($R1) == 0
  994.             set RegistryErrorIndex = REF_COUNT_NOT_ZERO
  995.             goto RemoveSoftwareComponent_Return
  996.         endif
  997.     endif
  998.     OpenRegKey $(!REG_H_LOCAL) "" $(RS_ManufacturerKey) $(MAXIMUM_ALLOWED) ProductKey
  999.     Ifstr $(ProductKey) == $(KeyNull)
  1000.        Debug-Output "UTILITY.INF: could not open Software product key"
  1001.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1002.        goto RemoveSoftwareComponent_Return
  1003.     endif
  1004.     DeleteRegTree $(ProductKey) $(RS_ProductName)
  1005.     CloseRegKey $(ProductKey)
  1006.     Shell "" RemoveService, $(RS_ProductName), "YES"
  1007.     Set RS_RemoveError = $($R0)
  1008.     Ifint $(RS_RemoveError) != 0
  1009.          Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
  1010.          Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
  1011.          Goto RemoveSoftwareComponent_Return
  1012.     Endif
  1013. RemoveSoftwareComponent_Return = +
  1014.     Return $(RegistryErrorIndex)
  1015. [RemoveHardwareComponent]
  1016.     Debug-Output "Remove Hardware Component..."
  1017.     read-syms InitBaseVars
  1018.     set RH_Manufacturer = $($0)
  1019.     set RH_ProductName  = $($1)
  1020.     set RH_VersionNum   = "CurrentVersion"
  1021.     set RH_ProductKey   = $(!NTN_SoftwareBase)"\"$($0)"\"$($1)"\"$(RH_VersionNum)
  1022.     set RH_NetCardName  = $($2)
  1023.     Split-String $(RH_NetCardName), "\", CardInfo
  1024.     set RH_NetCardNum   = *($(CardInfo),11)
  1025.     set RH_NetCardBase  = *($(CardInfo),1)*($(CardInfo),2)*($(CardInfo),3)*($(CardInfo),4)*($(CardInfo),5)*($(CardInfo),6)*($(CardInfo),7)*($(CardInfo),8)*($(CardInfo),9)
  1026.     set RegistryErrorIndex      = NO_ERROR
  1027.     Shell "", DecrementRefCount, $(RH_ProductKey)
  1028.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1029.         Debug-Output "UTILITY.INF: [AddHardwareComponent] IncrementRefCount returned "$(RegistryErrorIndex)
  1030.         goto RemoveHardwareComponent_Return
  1031.     endif
  1032.     OpenRegKey $(!REG_H_LOCAL) "" $(RH_NetCardBase) $(MAXIMUM_ALLOWED) NetCardKey
  1033.     Ifstr $(NetCardKey) == $(KeyNull)
  1034.        Debug-Output "UTILITY.INF: could not open NetworkCards key"
  1035.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1036.        goto RemoveHardwareComponent_Return
  1037.     endif
  1038.     OpenRegKey $(NetCardKey) "" $(RH_NetCardNum) $(MAXIMUM_ALLOWED) NetCardNumKey
  1039.     Ifstr $(NetCardNumKey) == $(KeyNull)
  1040.        Debug-Output "UTILITY.INF: could not open NetworkCards Number key"
  1041.        set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1042.        goto RemoveHardwareComponent_Return
  1043.     endif
  1044.     GetRegValue $(NetCardNumKey),"ServiceName", RH_ServiceNameInfo
  1045.     set RH_ServiceName = *($(RH_ServiceNameInfo), 4)
  1046.     ifstr(i) $(RH_ServiceName) == ""
  1047.         set RH_ServiceName = $(RH_ProductName)$(RH_NetCardNum)
  1048.     endif
  1049.     CloseRegKey $(NetCardNumKey)
  1050.     DeleteRegTree $(NetCardKey) $(RH_NetCardNum)
  1051.     CloseRegKey $(NetCardKey)
  1052.     Shell "", RemoveService, $(RH_ServiceName), "NO"
  1053.     Set RS_RemoveError = $($R0)
  1054.     Ifint $(RS_RemoveError) != 0
  1055.          Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
  1056.          Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
  1057.          Goto RemoveHardwareComponent_Return
  1058.     Endif
  1059.     Shell "", IsRefCountEqualZero, $(RH_ProductKey)
  1060.     Ifstr(i) $($R0) != NO_ERROR
  1061.         Debug-Output "UTILITY.INF: [RemoveHardwareComponent] IsRefCountEqualZero returned "$($R0)
  1062.         goto RemoveHardwareComponent_Return
  1063.     endif
  1064.     Ifint $($R1) == 1
  1065.         Debug-Output "Remove software component..."
  1066.         Shell "" RemoveSoftwareComponent, $(RH_Manufacturer), $(RH_ProductName)
  1067.         set RegistryErrorIndex = $($R0)
  1068.     endif
  1069.     debug-output "remove netbios information..."
  1070.     LibraryProcedure Result, $(!NCPA_HANDLE), RemoveRouteFromNETBIOS, $(RH_ServiceName)
  1071. RemoveHardwareComponent_Return = +
  1072.     Return $(RegistryErrorIndex)
  1073. [RemoveService]
  1074.     read-syms InitBaseVars
  1075.     Set RS_SvcName = $($0)
  1076.     Set RS_UseDelSvc = $($1)
  1077.     OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services\"$(RS_SvcName) +
  1078.         $(MAXIMUM_ALLOWED) ServiceKey
  1079.     Ifstr $(ServiceKey) == $(KeyNull)
  1080.         Debug-Output "UTILITY.INF: could not open SYSTEM Service key "$(RS_SvcName)
  1081.         goto RemoveService_Return
  1082.     endif
  1083.     OpenRegKey $(ServiceKey) "" "Parameters" $(MAXIMUM_ALLOWED) ParameterKey
  1084.     Ifstr $(ParameterKey) != $(KeyNull)
  1085.          DeleteRegValue $(ParameterKey) "NbProvider"
  1086.          CloseRegKey $(ParameterKey)
  1087.     Endif
  1088.     CloseRegKey $(ServiceKey)
  1089.     ifstr(i) $(RS_UseDelSvc) == "YES"
  1090.         Set FLibraryErrCtl = 1
  1091.         LibraryProcedure RS_RemoveResult $(!NCPA_HANDLE), CPlSetup, +
  1092.           $(!STF_HWND), DELETESVC, $(RS_SvcName)
  1093.         Set FLibraryErrCtl = 0
  1094.         Set RS_RemoveError = *($(RS_RemoveResult),1)
  1095.         Ifint $(RS_RemoveError) != 0
  1096.              Debug-Output "UTILITY.INF: RemoveService wrapper failed, error: "$(RS_RemoveResult)
  1097.              Set RegistryErrorIndex = UNABLE_REMOVE_CONFIGURE_SERVICE
  1098.              Goto RemoveService_Return
  1099.         Endif
  1100.     else
  1101.         OpenRegKey $(!REG_H_LOCAL) "" "SYSTEM\CurrentControlSet\Services" +
  1102.         $(MAXIMUM_ALLOWED) ServiceKey
  1103.         Ifstr $(ServiceKey) == $(KeyNull)
  1104.            Debug-Output "UTILITY.INF: could not open SYSTEM Service key "$(RS_SvcName)
  1105.            set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1106.            goto RemoveService_Return
  1107.         endif
  1108.         DeleteRegTree $(ServiceKey) $(RS_SvcName)
  1109.         CloseRegKey $(ServiceKey)
  1110.     endif
  1111. RemoveService_Return = +
  1112.     return $(RegistryErrorIndex)
  1113. [IsNetCardAlreadyInstalled]
  1114.     read-syms InitBaseVars
  1115.     set AlreadyExisted  = "NO"
  1116.     set BusNum  = $($0)
  1117.     set SlotNum = $($1)
  1118.     set Description = $($2)
  1119.     set Product = $($3)
  1120.     OpenRegKey $(!REG_H_LOCAL) "" $(NetworkCardKeyName) $(MAXIMUM_ALLOWED) IE_KeyNetcards
  1121.     Ifstr $(IE_KeyNetcards) == $(KeyNull)
  1122.        set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  1123.        goto IE_Return
  1124.     endif
  1125.     EnumRegKey $(IE_KeyNetcards) IE_KeyNameList
  1126.     ForListDo  $(IE_KeyNameList)
  1127.         set IE_KeyName = *($($),1)
  1128.         OpenRegKey $(IE_KeyNetcards) "" $(IE_KeyName) $(MAXIMUM_ALLOWED) IE_Card
  1129.         Ifstr $(IE_Card) == $(KeyNull)
  1130.            set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  1131.            goto IE_Return
  1132.         endif
  1133.         GetRegValue $(IE_Card),"Description", DescriptionInfo
  1134.         GetRegValue $(IE_Card),"ProductName", ProductNameInfo
  1135.         set CardDescription     = *($(DescriptionInfo), 4)
  1136.         set CardProductName     = *($(ProductNameInfo), 4)
  1137.         ifstr(i) $(CardDescription) == $(Description)
  1138.             ifstr(i) $(CardProductName) == $(Product)
  1139.                 GetRegValue $(IE_Card), "ServiceName", ServiceNameInfo
  1140.                 set ServiceName = *($(ServiceNameInfo), 4)
  1141.                 OpenRegKey $(!REG_H_LOCAL) "" +
  1142.                    $(ServicesBaseName)"\"$(ServiceName)"\Parameters" +
  1143.                    $(MAXIMUM_ALLOWED) IE_KeyService
  1144.                 Ifstr $(IE_KeyService) == $(KeyNull)
  1145.                    set RegistryErrorIndex = UNABLE_OPEN_NETWORKCARD_SECTION
  1146.                    goto IE_Return
  1147.                 endif
  1148.                 GetRegValue $(IE_KeyService), "BusNumber", BusInfo
  1149.                 GetRegValue $(IE_KeyService), "SlotNumber", SlotInfo
  1150.                 set CardBusNum = *($(BusInfo), 4)
  1151.                 set CardSlotNum = *($(SlotInfo), 4)
  1152.                 ifint $(CardBusNum) == $(BusNum)
  1153.                     ifint $(CardSlotNum) == $(SlotNum)
  1154.                         set AlreadyExisted = "YES"
  1155.                     endif
  1156.                 endif
  1157.             endif
  1158.         endif
  1159.     EndForListDo
  1160. IE_Return = +
  1161.     return $(RegistryErrorIndex) $(AlreadyExisted)
  1162. [UpdateWinsockService]
  1163.     read-syms InitBaseVars
  1164.     Set UW_NameOfService = $($0)
  1165.     Set UW_Adding        = $($1)
  1166.     Set UW_KeyServices   = $(KeyNull)
  1167.     Set UW_KeyParameters = $(KeyNull)
  1168.     Shell "", BaseServiceKey
  1169.     Set RegistryErrorIndex = $($R0)
  1170.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1171.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1172.        Goto U_W_Return
  1173.     endif
  1174.     Set UW_KeyServices = $($R1)
  1175.     OpenRegKey $(UW_KeyServices) "" "WinSock\Parameters" $(MAXIMUM_ALLOWED) UW_KeyParameters
  1176.     Ifstr(i) $(UW_KeyParameters) == $(KeyNull)
  1177.         Debug-Output "UTILITY.INF:  Create WinSock Service"
  1178.         Shell "", CreateService, "WinSock", "", "", "adapter", "", {}
  1179.         Set RegistryErrorIndex = $($R0)
  1180.         Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1181.             Debug-Output "UTILITY.INF: CreateService for WinSock returned "$(RegistryErrorIndex)
  1182.             Goto U_W_Return
  1183.         Endif
  1184.         CloseRegKey $($R1)
  1185.         Set UW_KeyParameters = $($R2)
  1186.         CloseRegKey $($R3)
  1187.     Else
  1188.         Debug-Output "UTILITY.INF:  Open WinSock Service"
  1189.     Endif
  1190.     Ifstr(i) $(UW_KeyParameters) == $(KeyNull)
  1191.         Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1192.         Goto U_W_Return
  1193.     Endif
  1194.     GetRegValue $(UW_KeyParameters) "Transports" UW_TransportsValue
  1195.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1196.         Set UW_TransportsList = *($(UW_TransportsValue), 4)
  1197.     Else
  1198.         Set UW_TransportsList = {}
  1199.     Endif
  1200.     Ifstr(i) $(UW_TransportsList) == ""
  1201.         Set UW_TransportsList = {}
  1202.     Endif
  1203.     Ifstr(i) $(UW_Adding) == "TRUE"
  1204.         Set UW_TransportsList = >($(UW_TransportsList), $(UW_NameOfService))
  1205.     Else
  1206.         Set UW_NewList = {}
  1207.         ForListDo $(UW_TransportsList)
  1208.             Ifstr(i) $($) != $(UW_NameOfService)
  1209.                 Set UW_NewList = >($(UW_NewList), $($))
  1210.             Endif
  1211.         EndForListDo
  1212.         Set UW_TransportsList = $(UW_NewList)
  1213.     Endif
  1214.     SetRegValue $(UW_KeyParameters) {Transports, $(NoTitle), $(!REG_VT_MULTI_SZ), $(UW_TransportsList)}
  1215.     Debug-Output "UTILITY.INF:  WinSock transport info added/deleted for "$(UW_NameOfService)
  1216. U_W_Return = +
  1217.     Ifstr $(UW_KeyParameters) != $(KeyNull)
  1218.         CloseRegKey $(UW_KeyParameters)
  1219.     Endif
  1220.     Ifstr $(UW_KeyServices) != $(KeyNull)
  1221.         CloseRegKey $(UW_KeyServices)
  1222.     Endif
  1223.     Return $(RegistryErrorIndex)
  1224. [AddWinsockInfo]
  1225.     read-syms InitBaseVars
  1226.     Set AW_NameOfService = $($0)
  1227.     Set AW_DLLName       = $($1)
  1228.     Set AW_MaxAddrLgt    = $($2)
  1229.     Set AW_MinAddrLgt    = $($3)
  1230.     Set AW_KeyServices   = $(KeyNull)
  1231.     Set AW_KeyParameters = $(KeyNull)
  1232.     Set AW_KeySockets    = $(KeyNull)
  1233.     Shell "", AddAFD
  1234.     Set RegistryErrorIndex = $($R0)
  1235.     Ifstr(i) $(RegistryErrorIndex) == NO_ERROR
  1236.         Shell "", BaseServiceKey
  1237.         Set RegistryErrorIndex = $($R0)
  1238.     Endif
  1239.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1240.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1241.        Goto A_W_Return
  1242.     endif
  1243.     Set AW_KeyServices = $($R1)
  1244.     OpenRegKey $(AW_KeyServices) "" $(AW_NameOfService)"\Parameters" $(MAXIMUM_ALLOWED) AW_KeyParameters
  1245.     Ifstr(i) $(AW_KeyParameters) == $(KeyNull)
  1246.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1247.        Goto A_W_Return
  1248.     Endif
  1249.     OpenRegKey $(AW_KeyParameters) "" "Winsock" $(MAXIMUM_ALLOWED) AW_KeySockets
  1250.     Ifstr(i) $(AW_KeySockets) == $(KeyNull)
  1251.         CreateRegKey $(AW_KeyParameters) {Winsock,$(NoTitle),GenericClass} "" $(MAXIMUM_ALLOWED) "" AW_KeySockets
  1252.     Endif
  1253.     Ifstr(i) $(AW_KeySockets) == $(KeyNull)
  1254.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1255.        Goto A_W_Return
  1256.     Endif
  1257.     Set AW_ValueList = {{HelperDllName    ,$(NoTitle),$(!REG_VT_EXPAND_SZ),$(AW_DLLName)},+
  1258.                         {MaxSockAddrLength,$(NoTitle),$(!REG_VT_DWORD),$(AW_MaxAddrLgt)},+
  1259.                         {MinSockAddrLength,$(NoTitle),$(!REG_VT_DWORD),$(AW_MinAddrLgt)}}
  1260.     Shell "", AddValueList, $(AW_KeySockets), $(AW_ValueList)
  1261.     Set RegistryErrorIndex = $($R0)
  1262.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1263.         Debug-Output "UTILITY.INF: [AddWinsockInfo] Registry error: Add value list"
  1264.     Endif
  1265.     Set FLibraryErrCtl = 1
  1266.     LibraryProcedure AW_MapResult $(!NCPA_HANDLE), CPlSetup, $(!STF_HWND), WINSOCKMAP, $(AW_DLLName), $(AW_KeySockets)
  1267.     Set FLibraryErrCtl = 0
  1268.     Set AW_MapError = *($(AW_MapResult),1)
  1269.     Ifint $(AW_MapError) != 0
  1270.         Debug-Output "UTILITY.INF: [AddWinsockInfo] WINSOCKMAP returned "$(AW_MapError)
  1271.         Set RegistryErrorIndex = UNABLE_ACCESS_WINSOCK_MAP_INFO
  1272.         Goto A_W_Return
  1273.     Endif
  1274.     Shell "" UpdateWinsockService $(AW_NameOfService) TRUE
  1275.     Set RegistryErrorIndex = $($R0)
  1276. A_W_Return = +
  1277.     Ifstr $(AW_KeySockets) != $(KeyNull)
  1278.         CloseRegKey $(AW_KeySockets)
  1279.     Endif
  1280.     Ifstr $(AW_KeyParameters) != $(KeyNull)
  1281.         CloseRegKey $(AW_KeyParameters)
  1282.     Endif
  1283.     Ifstr $(AW_KeyServices) != $(KeyNull)
  1284.         CloseRegKey $(AW_KeyServices)
  1285.     Endif
  1286.     Return $(RegistryErrorIndex)
  1287. [RemoveWinsockInfo]
  1288.     read-syms InitBaseVars
  1289.     Set RW_NameOfService = $($0)
  1290.     Set RW_KeyServices   = $(KeyNull)
  1291.     Set RW_KeySockets    = $(KeyNull)
  1292.     Shell "", BaseServiceKey
  1293.     Set RegistryErrorIndex = $($R0)
  1294.     Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  1295.        Set RegistryErrorIndex = UNABLE_ACCESS_CONFIGURE_SERVICE
  1296.        Goto R_W_Return
  1297.     endif
  1298.     Set RW_KeyServices = $($R1)
  1299.     OpenRegKey $(RW_KeyServices) "" $(RW_NameOfService)"\Parameters" $(MAXIMUM_ALLOWED) RW_KeySockets
  1300.     Ifstr(i) $(RW_KeySockets) == $(KeyNull)
  1301.        Set RegistryErrorIndex = NO_ERROR
  1302.        Goto R_W_Return
  1303.     Endif
  1304.     DeleteRegTree $(RW_KeySockets) "Winsock"
  1305.     Shell "" UpdateWinsockService $(RW_NameOfService) FALSE
  1306.     Set RegistryErrorIndex = $($R0)
  1307. R_W_Return = +
  1308.     Ifstr $(RW_KeySockets) != $(KeyNull)
  1309.         CloseRegKey $(RW_KeySockets)
  1310.     Endif
  1311.     Ifstr $(RW_KeyServices) != $(KeyNull)
  1312.         CloseRegKey $(RW_KeyServices)
  1313.     Endif
  1314.     Return $(RegistryErrorIndex)
  1315. [BindingInfo-DEC]
  1316. BindingInfo     = {+
  1317.                   "lanceDriver dec100Adapter non exclusive 100",+
  1318.                   "lanceDriver dec101Adapter non exclusive 100",+
  1319.                   "lanceDriver decetherworksturboAdapter non exclusive 100",+
  1320.                   "lanceDriver dec422Adapter non exclusive 100",+
  1321.                   "lanceDriver decpcAdapter non exclusive 100",+
  1322.                   "lanceDriver decstatAdapter non exclusive 100"+
  1323.                   }
  1324. [BindingInfo-WD]
  1325. BindingInfo     = {+
  1326.                           "smc8000nDriver smcisaAdapter non exclusive 100",+
  1327.                           "smc8000nDriver wd8003eaAdapter non exclusive 100",+
  1328.                           "smc8000nDriver wd8003waAdapter non exclusive 100",+
  1329.                           "smc8000nDriver wd8013epaAdapter non exclusive 100",+
  1330.                           "smc8000nDriver wd8013wpaAdapter non exclusive 100"+
  1331.                           }
  1332. [BindingInfo-PROTEON]
  1333. BindingInfo     = {+
  1334.                            "proteonDriver p1990Adapter non exclusive 100",+
  1335.                            "proteonDriver p1390Adapter non exclusive 100"+
  1336.                           }
  1337. [BindingInfo-IBM]
  1338. BindingInfo     = {"ibmtokDriver ibmtokAdapter non exclusive 100",+
  1339.                    "ibmtokDriver ibmtokmcAdapter non exclusive 100"}
  1340. [GetBindingInfo]
  1341.     set BindingInfo = {}
  1342.     read-syms BindingInfo-$($0)
  1343.     return "NO_ERROR", $(BindingInfo)
  1344. [AddStreams]
  1345.     read-syms InitBaseVars
  1346.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\streams" $(MAXIMUM_ALLOWED) BS_KeyServices
  1347.     Ifstr $(BS_KeyServices) == $(KeyNull)
  1348.         set OldOption = $(!NTN_InfOption)
  1349.         set !NTN_InfOption = STREAMS
  1350.         Shell "oemnxpst.inf" InstallOption $(!STF_LANGUAGE) "STREAMS" $(!STF_SRCDIR) $(!NtLmAddCopy) $(!NtLmDoCopy) $(!NtLmDoConfig)
  1351.         set !NTN_InfOption = $(OldOption)
  1352.     else
  1353.         CloseRegKey $(BS_KeyServices)
  1354.         Debug-Output "UTILITY.INF: streams already installed"
  1355.     endif
  1356.     Shell "", IncrementRefCount, "Software\Microsoft\streams\CurrentVersion"
  1357. AddStreamsReturn = +
  1358.     return NO_ERROR
  1359. [RemoveStreams]
  1360.     read-syms InitBaseVars
  1361.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\streams" $(MAXIMUM_ALLOWED) BS_KeyServices
  1362.     Ifstr $(BS_KeyServices) != $(KeyNull)
  1363.         CloseRegKey $(BS_KeyServices)
  1364.         Shell "", DecrementRefCount, "Software\Microsoft\streams\CurrentVersion"
  1365.         Shell "", IsRefCountEqualZero, "Software\Microsoft\streams\CurrentVersion"
  1366.         Ifstr(i) $($R0) != NO_ERROR
  1367.             Debug-Output "UTILITY.INF: [RemoveSoftwareComponent] IsRefCountEqualZero returned "$($R0)
  1368.             goto RemoveStreamsReturn
  1369.         endif
  1370.         Ifint $($R1) != 1
  1371.             goto RemoveStreamsReturn
  1372.         endif
  1373.         set OldOption = $(!NTN_InfOption)
  1374.         set OldInstallMode = $(!NTN_InstallMode)
  1375.         set !NTN_InfOption = STREAMS
  1376.         set !NTN_InstallMode = deinstall
  1377.         Shell "oemnxpst.inf" InstallOption $(!STF_LANGUAGE) "STREAMS" $(!STF_SRCDIR) $(!NtLmAddCopy) $(!NtLmDoCopy) $(!NtLmDoConfig)
  1378.         set !NTN_InfOption = $(OldOption)
  1379.         set !NTN_InstallMode = $(OldInstallMode)
  1380.     endif
  1381. RemoveStreamsReturn = +
  1382.     return NO_ERROR
  1383. [AFDVars]
  1384. ProductAFDName          = "Afd"
  1385. ProductAFDTitle         = "AFD Networking Support Environment"
  1386. ProductAFDImagePath     = "\SystemRoot\System32\drivers\afd.sys"
  1387. ProductAFDSvcType       = "kernelautostart"
  1388. [AddAFD]
  1389.     read-syms InitBaseVars
  1390.     read-syms AFDVars
  1391.     Set Result = NO_ERROR
  1392.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\AFD" $(MAXIMUM_ALLOWED) BS_KeyServices
  1393.     Ifstr $(BS_KeyServices) == $(KeyNull)
  1394.         Shell "", CreateService, $(ProductAFDName),+
  1395.             $(ProductAFDTitle),+
  1396.             $(ProductAFDImagePath),+
  1397.             $(ProductAFDSvcType), "", {"+TDI"}, "",+
  1398.             "%SystemRoot%\System32\IoLogMsg.dll"
  1399.         Set Result = $($R0)
  1400.     else
  1401.         CloseRegKey $(BS_KeyServices)
  1402.     endif
  1403. AddAFDReturn = +
  1404.     return $(Result)
  1405. [GetBusTypeNum]
  1406.     read-syms InitBaseVars
  1407.     set DetCard = $(!p:DetectedCard)
  1408.     ifstr(i) $(DetCard) == ""
  1409.         set DetCard = FALSE
  1410.     endif
  1411.     ifstr(i) $(DetCard) == FALSE
  1412.         set BusType = 1
  1413.         ifstr(i) $(!STF_BUSTYPE) == "ISA"
  1414.             set BusType = 1
  1415.         else-ifstr(i) $(!STF_BUSTYPE) == "EISA"
  1416.             set BusType = 2
  1417.         else-ifstr(i) $(!STF_BUSTYPE) == "Jazz-Internal Bus"
  1418.             set BusType = 0
  1419.         else-ifstr(i) $(!STF_BUSTYPE) == "MCA"
  1420.             set BusType = 3
  1421.         else-ifstr(i) $(!STF_BUSTYPE) == "TCChannel"
  1422.             set BusType = 4
  1423.         else
  1424.             debug-output "Utility.inf: Unknown bus type"
  1425.         endif
  1426.     else
  1427.         set BusType = *($(!STF_NCDETINFO),5)
  1428.     endif
  1429.     return NO_ERROR, $(BusType)
  1430. [AddRpcProtocol]
  1431.     Set ARP_Protocol = $($0)
  1432.     Set ARP_ClientDll = $($1)
  1433.     Set ARP_ServerDll = $($2)
  1434.     read-syms InitBaseVars
  1435.     Set ARP_KeyRpc = $(KeyNull)
  1436.     Set ARP_KeyRpcServer = $(KeyNull)
  1437.     Set ARP_KeyRpcClient = $(KeyNull)
  1438.     Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  1439.     OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) ARP_KeyRpc
  1440.     Ifstr(i) $(ARP_KeyRpc) == $(KeyNull)
  1441.        Goto ARP_Return
  1442.     Endif
  1443.     OpenRegKey $(ARP_KeyRpc) "" "ClientProtocols" $(MAXIMUM_ALLOWED) ARP_KeyClient
  1444.     Ifstr(i) $(ARP_KeyClient) == $(KeyNull)
  1445.        Goto ARP_Return
  1446.     Endif
  1447.     OpenRegKey $(ARP_KeyRpc) "" "ServerProtocols" $(MAXIMUM_ALLOWED) ARP_KeyServer
  1448.     Ifstr(i) $(ARP_KeyServer) == $(KeyNull)
  1449.        Goto ARP_Return
  1450.     Endif
  1451.     SetRegValue $(ARP_KeyClient) {$(ARP_Protocol),$(NoTitle),$(!REG_VT_SZ),$(ARP_ClientDll)}
  1452.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1453.         Goto ARP_Return
  1454.     Endif
  1455.     SetRegValue $(ARP_KeyServer) {$(ARP_Protocol),$(NoTitle),$(!REG_VT_SZ),$(ARP_ServerDll)}
  1456.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1457.         Goto ARP_Return
  1458.     Endif
  1459.     Set RegistryErrorIndex = NO_ERROR
  1460. ARP_Return = +
  1461.     Ifstr(i) $(ARP_KeyServer) != $(KeyNull)
  1462.         CloseRegKey $(ARP_KeyServer)
  1463.     Endif
  1464.     Ifstr(i) $(ARP_KeyClient) != $(KeyNull)
  1465.         CloseRegKey $(ARP_KeyClient)
  1466.     Endif
  1467.     Ifstr(i) $(ARP_KeyRpc) != $(KeyNull)
  1468.         CloseRegKey $(ARP_KeyRpc)
  1469.     Endif
  1470.     Return  $(RegistryErrorIndex)
  1471. [RemoveRpcProtocol]
  1472.     Set RRP_Protocol = $($0)
  1473.     read-syms InitBaseVars
  1474.     Set RRP_KeyRpc = $(KeyNull)
  1475.     Set RRP_KeyRpcServer = $(KeyNull)
  1476.     Set RRP_KeyRpcClient = $(KeyNull)
  1477.     Set RegistryErrorIndex = UNABLE_ACCESS_SOFTWARE_REG
  1478.     OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Rpc" $(MAXIMUM_ALLOWED) RRP_KeyRpc
  1479.     Ifstr(i) $(RRP_KeyRpc) == $(KeyNull)
  1480.        Goto RRP_Return
  1481.     Endif
  1482.     OpenRegKey $(RRP_KeyRpc) "" "ClientProtocols" $(MAXIMUM_ALLOWED) RRP_KeyClient
  1483.     Ifstr(i) $(RRP_KeyClient) == $(KeyNull)
  1484.        Goto RRP_Return
  1485.     Endif
  1486.     OpenRegKey $(RRP_KeyRpc) "" "ServerProtocols" $(MAXIMUM_ALLOWED) RRP_KeyServer
  1487.     Ifstr(i) $(RRP_KeyServer) == $(KeyNull)
  1488.        Goto RRP_Return
  1489.     Endif
  1490.     DeleteRegValue $(RRP_KeyClient) $(RRP_Protocol)
  1491.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1492.         Goto RRP_Return
  1493.     Endif
  1494.     DeleteRegValue $(RRP_KeyServer) $(RRP_Protocol)
  1495.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1496.         Goto RRP_Return
  1497.     Endif
  1498.     Set RegistryErrorIndex = NO_ERROR
  1499. RRP_Return = +
  1500.     Ifstr(i) $(RRP_KeyServer) != $(KeyNull)
  1501.         CloseRegKey $(RRP_KeyServer)
  1502.     Endif
  1503.     Ifstr(i) $(RRP_KeyClient) != $(KeyNull)
  1504.         CloseRegKey $(RRP_KeyClient)
  1505.     Endif
  1506.     Ifstr(i) $(RRP_KeyRpc) != $(KeyNull)
  1507.         CloseRegKey $(RRP_KeyRpc)
  1508.     Endif
  1509.     Return  $(RegistryErrorIndex)
  1510. [GetInfFileNameFromRegistry]
  1511.     read-syms InitBaseVars
  1512.     set KeyProduct = $($0)
  1513.     set InfName = ""
  1514.     OpenRegKey $(KeyProduct) "" "NetRules" $(!REG_KEY_READ) NetRuleKey
  1515.     Ifstr(i) $(NetRuleKey) != $(KeyNull)
  1516.         GetRegValue $(NetRuleKey) "InfName" NetRuleInfNameList
  1517.         set NetRuleInfName = *($(NetRuleInfNameList), 4)
  1518.         Split-String $(NetRuleInfName), "\", FilenameList
  1519.         QueryListSize ListSize $(FilenameList)
  1520.         set InfName = *($(FilenameList), $(ListSize))
  1521.         CloseRegKey $(KeyProduct)
  1522.     endif
  1523.     return $(InfName)
  1524. [ToggleBinding]
  1525.     Set SvcName = $($0)
  1526.     Set BindNumber = $($1)
  1527.     Set Action = $($2)
  1528.     Set Status = UNABLE_ACCESS_CONFIGURE_SERVICE
  1529.     Set KeySvc = ""
  1530.     Set KeyFrom = ""
  1531.     Set KeyTo = ""
  1532.     read-syms InitBaseVars
  1533.     OpenRegKey $(!REG_H_LOCAL) "" $(ServicesBaseName)"\"$(SvcName) $(MAXIMUM_ALLOWED) KeySvc
  1534.     Ifstr(i) $(KeySvc) == $(KeyNull)
  1535.         Debug-Output "UTILITY.INF: ToggleBinding: service key open FAILED"
  1536.         Goto TB_Return
  1537.     Endif
  1538.     Ifstr(i) $(Action) == activate
  1539.         Set FromKeyName = "Linkage\Disabled"
  1540.         Set ToKeyName   = "Linkage"
  1541.     Else
  1542.         Set FromKeyName = "Linkage"
  1543.         Set ToKeyName   = "Linkage\Disabled"
  1544.     Endif
  1545.     OpenRegKey $(KeySvc) "" $(FromKeyName) $(MAXIMUM_ALLOWED) KeyFrom
  1546.     Ifstr(i) $(KeyFrom) == $(KeyNull)
  1547.         Debug-Output "UTILITY.INF: ToggleBinding: from linkage key open FAILED"
  1548.         Goto TB_Return
  1549.     Endif
  1550.     OpenRegKey $(KeySvc) "" $(ToKeyName) $(MAXIMUM_ALLOWED) KeyTo
  1551.     Ifstr(i) $(KeyTo) == $(KeyNull)
  1552.         Debug-Output "UTILITY.INF: ToggleBinding: to linkage key open FAILED"
  1553.         Goto TB_Return
  1554.     Endif
  1555.     Set FromBindList   = {}
  1556.     Set FromExportList = {}
  1557.     Set FromRouteList  = {}
  1558.     Set ToBindList     = {}
  1559.     Set ToExportList   = {}
  1560.     Set ToRouteList    = {}
  1561.     Set ErrorTotal     = 0
  1562.     Debug-Output "UTILITY.INF: ToggleBinding; fetch all linkage values"
  1563.     GetRegValue $(KeyFrom),"Bind",TempValue
  1564.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1565.         Set FromBindList = *($(TempValue),4)
  1566.         Set-add ErrorTotal = $(ErrorTotal),1
  1567.     Endif
  1568.     GetRegValue $(KeyFrom),"Export",TempValue
  1569.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1570.         Set FromExportList = *($(TempValue),4)
  1571.         Set-add ErrorTotal = $(ErrorTotal),1
  1572.     Endif
  1573.     GetRegValue $(KeyFrom),"Route",TempValue
  1574.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1575.         Set FromRouteList = *($(TempValue),4)
  1576.         Set-add ErrorTotal = $(ErrorTotal),1
  1577.     Endif
  1578.     GetRegValue $(KeyTo),"Bind",TempValue
  1579.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1580.         Set ToBindList = *($(TempValue),4)
  1581.         Set-add ErrorTotal = $(ErrorTotal),1
  1582.     Endif
  1583.     GetRegValue $(KeyTo),"Export",TempValue
  1584.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1585.         Set ToExportList = *($(TempValue),4)
  1586.         Set-add ErrorTotal = $(ErrorTotal),1
  1587.     Endif
  1588.     GetRegValue $(KeyTo),"Route",TempValue
  1589.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1590.         Set ToRouteList = *($(TempValue),4)
  1591.         Set-add ErrorTotal = $(ErrorTotal),1
  1592.     Endif
  1593.     Ifint $(ErrorTotal) != 6
  1594.         Debug-Output "UTILITY.INF: ToggleBinding; Bind list retreival error, "$(ErrorTotal)
  1595.     Endif
  1596.     Debug-Output "UTILITY.INF: ToggleBinding; sanity check results"
  1597.     QueryListSize sz1 $(FromBindList)
  1598.     QueryListSize sz2 $(FromExportList)
  1599.     QueryListSize sz3 $(FromRouteList)
  1600.     Ifint $(sz1) != $(sz2)
  1601.         Goto TB_Return
  1602.     Endif
  1603.     Ifint $(sz1) != $(sz3)
  1604.         Goto TB_Return
  1605.     Endif
  1606.     QueryListSize sz2 $(ToBindList)
  1607.     QueryListSize sz3 $(ToExportList)
  1608.     QueryListSize sz4 $(ToRouteList)
  1609.     Ifint $(sz2) != $(sz3)
  1610.         Goto TB_Return
  1611.     Endif
  1612.     Ifint $(sz2) != $(sz4)
  1613.         Goto TB_Return
  1614.     Endif
  1615.     Debug-Output "UTILITY.INF: ToggleBinding; prepare to move binding"
  1616.     Ifint $(BindNumber) > $(sz1)
  1617.         Debug-Output "UTILITY.INF: ToggleBinding; binding to move was invalid"
  1618.         Set Status = INVALID_DATA_PASSED
  1619.     Endif
  1620.     Set FromBindItem   = *($(FromBindList),$(BindNumber))
  1621.     Set FromRouteItem  = *($(FromRouteList),$(BindNumber))
  1622.     Set FromExportItem = *($(FromExportList),$(BindNumber))
  1623.     Set ToBindList   = >($(ToBindList),$(FromBindItem))
  1624.     Set ToRouteList  = >($(ToRouteList),$(FromRouteItem))
  1625.     Set ToExportList = >($(ToExportList),$(FromExportItem))
  1626.     Set NewBind   = {}
  1627.     Set NewExport = {}
  1628.     Set NewRoute  = {}
  1629.     Set Index = 0
  1630.     ForListDo $(FromBindList)
  1631.         Set-add Index = $(Index),1
  1632.         Ifint $(Index) != $(BindNumber)
  1633.             Set NewBind   = >($(NewBind),$($))
  1634.             Set NewExport = >($(NewExport),*($(FromExportList),$(Index)))
  1635.             Set NewRoute  = >($(NewRoute),*($(FromRouteList),$(Index)))
  1636.         Endif
  1637.     EndForListDo
  1638.     Set FromBindList   = $(NewBind)
  1639.     Set FromExportList = $(NewExport)
  1640.     Set FromRouteList  = $(NewRoute)
  1641.     Set ErrorTotal = 0
  1642.     SetRegValue $(KeyFrom) {Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromBindList)}
  1643.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1644.         Set-add ErrorTotal = $(ErrorTotal),1
  1645.     Endif
  1646.     SetRegValue $(KeyFrom) {Export,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromExportList)}
  1647.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1648.         Set-add ErrorTotal = $(ErrorTotal),1
  1649.     Endif
  1650.     SetRegValue $(KeyFrom) {Route,$(NoTitle),$(!REG_VT_MULTI_SZ),$(FromRouteList)}
  1651.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1652.         Set-add ErrorTotal = $(ErrorTotal),1
  1653.     Endif
  1654.     SetRegValue $(KeyTo) {Bind,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToBindList)}
  1655.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1656.         Set-add ErrorTotal = $(ErrorTotal),1
  1657.     Endif
  1658.     SetRegValue $(KeyTo) {Export,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToExportList)}
  1659.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1660.         Set-add ErrorTotal = $(ErrorTotal),1
  1661.     Endif
  1662.     SetRegValue $(KeyTo) {Route,$(NoTitle),$(!REG_VT_MULTI_SZ),$(ToRouteList)}
  1663.     Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1664.         Set-add ErrorTotal = $(ErrorTotal),1
  1665.     Endif
  1666.     Debug-Output "UTILITY.INF: ToggleBinding; Registry update error total = "$(ErrorTotal)
  1667.     Ifint $(ErrorTotal) != 0
  1668.        Set Status = UNABLE_WRITE_REGISTRY
  1669.     Else
  1670.        Set Status = NO_ERROR
  1671.     Endif
  1672. TB_Return = +
  1673.     Ifstr(i) $(KeyFrom) != $(KeyNull)
  1674.        CloseRegKey $(KeyFrom)
  1675.     Endif
  1676.     Ifstr(i) $(KeyTo) != $(KeyNull)
  1677.        CloseRegKey $(KeyTo)
  1678.     Endif
  1679.     Ifstr(i) $(KeySvc) != $(KeyNull)
  1680.        CloseRegKey $(KeySvc)
  1681.     Endif
  1682.     Return $(Status)
  1683. [SortListIndex]
  1684.     Set List = $($0)
  1685.     Set BoolAscend = $($1)
  1686.     Set BoolCaseSens = $($2)
  1687.     LibraryProcedure IndexList, $(!LIBHANDLE), GenerateSortedIndexList, $(List), $(BoolAscend), $(BoolCaseSens)
  1688.     Return $(IndexList)
  1689. [SortByIndex]
  1690.    Set List = $($0)
  1691.    Set IndexList = $($1)
  1692.    Set NewList = {}
  1693.    ForListDo $(IndexList)
  1694.       Set Index = $($)
  1695.       Set Item = *($(List),$(Index))
  1696.       Set NewList = >($(NewList),$(Item))
  1697.    EndForListDo
  1698.    Return $(NewList)
  1699. [SortList]
  1700.     Set List = $($0)
  1701.     Shell "" SortListIndex $(List) $($1) $($2)
  1702.     Set IndexList = $($R0)
  1703.     Shell "" SortByIndex $(List) $(IndexList)
  1704.     Set ResultList = $($R0)
  1705.     return $(ResultList)
  1706. [DetectionDllFiles]
  1707.     DetectionDllsFound = {} ? $(!LIBHANDLE) FindFileInstances $(!STF_WINDOWSSYSPATH)"\???ncdet.dll"
  1708. [UpdateDetectionDllNames]
  1709.     Set Status = STATUS_FAILED
  1710.     read-syms InitBaseVars
  1711.     Detect DetectionDllFiles
  1712.     Set DllValueName = "NetcardDlls"
  1713.     OpenRegKey $(!REG_H_LOCAL) "" "System\Setup" $(MAXIMUM_ALLOWED) KeySetup
  1714.     Ifstr(i) $(KeySetup) == $(KeyNull)
  1715.         Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] cant open System\Setup key"
  1716.         Goto UDDN_Return
  1717.     Endif
  1718.     Set NewDllList = {"MSNCDET.DLL"}
  1719.     ForListDo $(DetectionDllsFound)
  1720.         Set NewDllList = >($(NewDllList),$($))
  1721.     EndForListDo
  1722.     Set UpdateRequired = 1
  1723.     GetRegValue $(KeySetup) $(DllValueName) DllNamesValue
  1724.     Ifint $(RegLastError) == $(!REG_ERROR_SUCCESS)
  1725.         Set DllNames = *($(DllNamesValue),4)
  1726.         Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] DllNames = "$(DllNames)
  1727.         Set UpdateRequired = 0
  1728.         ForListDo $(NewDllList)
  1729.             Set DllIndex = ~($(DllNames),$($))
  1730.             Ifint $(DllIndex) == 0
  1731.                 Set UpdateRequired = 1
  1732.             Endif
  1733.         EndForListDo
  1734.     Endif
  1735.     Set Status = STATUS_SUCCESSFUL
  1736.     Ifint $(UpdateRequired) == 1
  1737.         Debug-Output "UTILITY.INF: [UpdateDetectionDllNames] new DLL names = "$(NewDllList)
  1738.         Set ValueInfo = {$(DllValueName), $(NoTitle), $(!REG_VT_MULTI_SZ), $(NewDllList)}
  1739.         SetRegValue $(KeySetup) $(ValueInfo)
  1740.         Ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
  1741.             Set Status = STATUS_FAILED
  1742.         Else
  1743.             Shell "NCPARAM.INF" Param_ControlDetection DTEND
  1744.             Shell "NCPARAM.INF" Param_ControlDetection DTSTART
  1745.         Endif
  1746.     Else
  1747.         Set Status = STATUS_USERCANCEL
  1748.     Endif
  1749.     CloseRegKey $(KeySetup)
  1750. UDDN_Return = +
  1751.     Return $(Status)
  1752. [CheckIfCopyNecessary]
  1753.     Set Status = STATUS_SUCCESSFUL
  1754.     Set PathList = $($0)
  1755.     Set NamesList = $($1)
  1756.     Set Index = 0
  1757.     Set Found = 1
  1758.     ForListDo $(PathList)
  1759.         Set ThisPath = $($)
  1760.         Set-add Index = Index,1
  1761.         Set NameList = *($(NamesList),$(Index))
  1762.         ForListDo $(NameList)
  1763.             Set FileToCheck = $(ThisPath)\$($)
  1764.             LibraryProcedure FilePresent,$(!LIBHANDLE), CheckFileExistance $(FileToCheck)
  1765.             Ifstr(i) $(FilePresent) != "YES"
  1766.                 Set Found = 0
  1767.             Endif
  1768.         EndForListDo
  1769.     EndForListDo
  1770.     Ifint $(Found) != 1
  1771.         Set Status = STATUS_FAILED
  1772.     Endif
  1773.     Return $(Status)
  1774. [GetBusTypeDialog]
  1775.     set CardName = $($0)
  1776.     set BusInterfaceType = $($1)
  1777.     set BusNumber = $($2)
  1778.     ifstr(i) $(BusInterfaceType) == ""
  1779.         set BusInterfaceType = 1        
  1780.     endif
  1781.     ifstr(i) $(BusNumber) == ""
  1782.         set BusNumber = 0               
  1783.     endif
  1784.     set FLibraryErrCtl = 1
  1785.     LibraryProcedure BusInfo $(!NCPA_HANDLE), GetBusTypeDialog, $(!STF_HWND), $(CardName), $(BusInterfaceType), $(BusNumber)
  1786.     set FLibraryErrCtl = 0
  1787.     ifint *($(BusInfo),1) == 0
  1788.         set ReturnValue = NO_ERROR
  1789.         set BusInterfaceType = *($(BusInfo),2)
  1790.         set BusNumber = *($(BusInfo),3)
  1791.     else
  1792.         set ReturnValue = ERROR
  1793.     endif
  1794.     Return $(ReturnValue), $(BusInterfaceType), $(BusNumber)
  1795. [RegistryErrorsENG]
  1796. UNABLE_ACCESS_SOFTWARE_REG,"Unable to access SOFTWARE subtree in Registry"
  1797. UNABLE_CREATE_MANUFACTURER_KEY,"Unable to create Manufacturer key in Registry"
  1798. UNABLE_OPEN_MICROSOFT_KEY,"Unable to open Microsoft subkey in Registry"
  1799. UNABLE_CREATE_PRODUCT_KEY,"Unable to create subkey in Registry for Windows NT"
  1800. UNABLE_CREATE_PRODUCT_VERSION,"Unable to create version subkey in Registry for Windows NT"
  1801. UNABLE_CREATE_NETRULES_KEY,"Unable to create a NetRules subkey in Registry"
  1802. UNABLE_OPEN_HARDWARE_SECTION,"Unable to open HARDWARE subkey in Registry"
  1803. UNABLE_OPEN_NETWORKCARD_SECTION,"Unable to open NetworkCards subkey in Registry"
  1804. UNABLE_OPEN_EVENTLOG_SUBKEY,"Unable to open Eventlog subkey in Registry"
  1805. UNABLE_CREATE_NETCARD_CONFIGURATION,"Unable to create entry for network adapter in Registry"
  1806. UNABLE_ACCESS_CONFIGURE_SERVICE,"Unable to access Services subkey in Registry"
  1807. UNABLE_CREATE_CONFIGURE_SERVICE,"Unable to create Services subkey in Registry"
  1808. UNABLE_CREATE_SERVICE_SUBKEY,"Unable to create Services subkey in Registry"
  1809. INVALID_DATA_PASSED,"Invalid data passed to Registry utility routine"
  1810. SERVICE_AREA_ALREADY_EXIST,"Registry Service subkey already exists"
  1811. OPERATION_UNIMPLEMENTED,"Registry operation UNIMPLEMENTED"
  1812. CANNOT_FIND_COMPONENT_SERVICE,"Component service name not found or non-existent"
  1813. CANNOT_CONFIGURE_HARDWARE,"Cannot configure the hardware component"
  1814. CANNOT_CONFIGURE_SOFTWARE,"Cannot configure the software component"
  1815. UNABLE_WRITE_REGISTRY, "Cannot write to registry"
  1816. UNABLE_INSTALL, "Installation Error"
  1817. PROVIDER_ALREADY_EXISTED, "Provider already exists in Registry"
  1818. PROVIDER_ORDER_DOES_NOT_EXIST, "Provider order does not exist in Registry."
  1819. TCPIP_NONEXIST_ERROR, "Please install Microsoft TCP/IP before installing SNMP."
  1820. TCPIP_NONEXIST_ERROR_FTPD, "Please install Microsoft TCP/IP before installing FTP Server."
  1821. NO_BINDING_INFO, "Missing Binding Information. Please click BINDINGS button first."
  1822. CANNOT_OPEN_EVENTLOG_KEY, "Cannot open Eventlog subkey in Registry."
  1823. CANNOT_CREATE_SNMPPROXYKEY, "Cannot create SNMP Proxy subkey in Registry."
  1824. REF_COUNT_NOT_ZERO, "Please remove all related network adapter cards before removing the software driver."
  1825. UNABLE_REMOVE_CONFIGURE_SERVICE,"Unable to remove Services subkey for a software driver in Registry"
  1826. UNABLE_ACCESS_WINSOCK_MAP_INFO,"Unable to access WinSock mapping information in DLL"
  1827. VERIFY_WARNING,"The current netcard parameters are not verifiably correct and may result in usage problems or system failure.  Use them anyway?"
  1828. CANNOT_DETECT,"Setup is unable to obtain network adapter information from the associated network adapter DLL files.  Operation cannot continue."
  1829. UNABLE_COPY_FILE,"File copy operation failed."
  1830. ASK_SOURCE_FAIL,"Failed to obtain source file location."
  1831. SETUP_FAIL,"Setup operation failed."
  1832. SERVICE_MARKED_FOR_DELETE,"Unable to reinstall deleted service without system restart."
  1833. REBOOT_MACHINE_BEFORE_ADD_ADAPTER,"Please reboot your machine before you add a new adapter card."
  1834. NO_ERROR, ""
  1835. [RegistryErrorUnknownENG]
  1836. Error_Bogus = "UNKNOWN REGISTRY FAILURE"
  1837. [VerExistedENG]
  1838. ver = " ver "
  1839. Text = " already exists on the system. Please use [Update] to update the software."
  1840. [CardExistedENG]
  1841. Text = "A network card of this type is already installed in the system. Do you want to continue?"
  1842. [ProgressCopyENG]
  1843.     !p:ProCaption   = "Windows NT Networking Setup"
  1844.     !p:ProCancel    = "Cancel"
  1845.     !p:ProCancelMsg = "Windows NT is not correcly installed.  Are you sure you want "+
  1846.                       "to cancel copying files?"
  1847.     !p:ProCancelCap = "Setup Message"
  1848.     !p:ProText1     = "Copying:"
  1849.     !p:ProText2     = "To:"
  1850.     !p:Error        = "Unable to determine proper source disk location; copy cannot be performed."
  1851.  
  1852.  
  1853.  
  1854.